`$tasks` is undefined in case no tasks are found. use instead : 

```php
$taks = array_map(function () {//...}, $app['manipulator.task']->getRepository()->findAll());
```