mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Add task repository as a service
This commit is contained in:
@@ -28,7 +28,7 @@ class TaskList extends Command
|
||||
{
|
||||
$output->writeln("<info>Querying the task manager...</info>");
|
||||
$errors = 0;
|
||||
$tasks = $this->container['manipulator.task']->getRepository()->findAll();
|
||||
$tasks = $this->container['repo.tasks']->findAll();
|
||||
$infos = $this->container['task-manager.live-information']->getTasks($tasks);
|
||||
$rows = [];
|
||||
|
||||
|
@@ -45,7 +45,7 @@ class TaskRun extends Command
|
||||
{
|
||||
declare(ticks=1);
|
||||
|
||||
if (null === $task = $this->container['manipulator.task']->getRepository()->find($input->getArgument('task_id'))) {
|
||||
if (null === $task = $this->container['repo.tasks']->find($input->getArgument('task_id'))) {
|
||||
throw new RuntimeException('Invalid task_id');
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ class TaskState extends Command
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$task_id = $input->getArgument('task_id');
|
||||
if (null === $task = $this->container['manipulator.task']->getRepository()->find($task_id)) {
|
||||
if (null === $task = $this->container['repo.tasks']->find($task_id)) {
|
||||
throw new RuntimeException('Invalid task_id');
|
||||
}
|
||||
|
||||
|
@@ -146,7 +146,7 @@ class TaskManager implements ControllerProviderInterface
|
||||
{
|
||||
$tasks = [];
|
||||
|
||||
foreach ($app['manipulator.task']->getRepository()->findAll() as $task) {
|
||||
foreach ($app['repo.tasks']->findAll() as $task) {
|
||||
$tasks[] = array_replace(
|
||||
$app['task-manager.live-information']->getTask($task), [
|
||||
'id' => $task->getId(),
|
||||
|
@@ -187,6 +187,9 @@ class ORMServiceProvider implements ServiceProviderInterface
|
||||
$app['repo.users'] = $app->share(function (PhraseaApplication $app) {
|
||||
return $app['EM']->getRepository('Phraseanet:User');
|
||||
});
|
||||
$app['repo.tasks'] = $app->share(function (PhraseaApplication $app) {
|
||||
return $app['EM']->getRepository('Phraseanet:Task');
|
||||
});
|
||||
}
|
||||
|
||||
public function boot(Application $app)
|
||||
|
Reference in New Issue
Block a user