Consider this kind of code which pushes a task to queue to run a custom handler method that is located within the same class:
<?php namespace Space;
class Spaceship {
public static function cruise()
{
// Throtting in 3 seconds...
Queue::later(3, '\Space\Spaceship@throttle', $coordinates, 'queue-name');
}
public static function throttle($job, $data)
{
$job->delete();
return 'ok';
}
}
This worked fine before I added $job->delete(); but now its giving an error:
exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to a member function delete() on a non-object
In Laravel 4.2 docs there is no explanation why with a push queue task pointed to a custom handler method you wouldn't need to explicitly delete the task from the queue with $job->delete() ? Yet that kind of implementation works and when the $job parameter is logged, it's false.