juriansluiman/SlmQueue — pull request #11 by bakura10 (2013-02-11 18:09:28+00:00)
Title: Taskable jobs

ping @juriansluiman @Fraak

Not sure if this is a good idea or not but I found that in my future application, it would be much easier to decompose a job into multiple task (for instance for image processing where you would like to do resize, then do some operations... and those tasks could change).

So I created a new Task interface, and a TaskableJob that simply extends AbstractJob, and delegate the job to all the tasks that are inserted into a priority queue. It would work like that:

```php
$job = new TaskableJob(array('name' => 'image1.jpg'));
$job->addTask(new ResizeTask(), 10);
$job->addTask(new IncreaseContrastTask(), 4);

if ($this->params('blackAndWhite')) {
$job->addTask(new ConvertToBlackAndWhite(), 2);
}

$job->execute();
```

Of course if you like the idea, I'll add a TaskPluginManager so that task are pulled from the service locator too.