juriansluiman/SlmQueue — pull request #61 by juriansluiman (2014-01-22 22:06:16+00:00)
Title: Ease creation of jobs with controller plugin

We might make it easier for users to create a job and insert in into the queue from controllers. If you do not inject anything, these are the required steps:

```
class FooController extends AbstractActionController
{
public function barAction()
{
$sl = $this->getServiceLocator();
$manager = $sl->get('SlmQueue\Queue\QueuePluginManager');
$queue = $manager->get('My-Queue');

$manager = $sl->get('SlmQueue\Job\JobPluginManager');
$job = $manager->get('Foo\Job\BazJob');

$queue->push($job);
}
}
```

You need to inject the queue plugin manager and the job plugin manager to remove the service location pattern. I was now thinking something like:

```
class FooController extends AbstractActionController
{
public function barAction()
{
$this->queue('My-Queue')->push('Foo\Job\BazJob');
}
}
```

With above, the queue plugin is stateful, but it's imho the easiest to push multiple jobs. We can add a payload with a second argument: `push( $name, $payload = null)`