Skip to content

Commit 6c474c6

Browse files
fixed refactored
1 parent 85506c7 commit 6c474c6

File tree

10 files changed

+13
-203
lines changed

10 files changed

+13
-203
lines changed

src/Command/DebugTasksCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Symfony\Component\Console\Input\InputInterface;
88
use Symfony\Component\Console\Input\InputOption;
99
use Symfony\Component\Console\Output\OutputInterface;
10-
use Task\Storage\TaskExecutionRepositoryInterface;
10+
use Task\Execution\TaskExecutionRepositoryInterface;
1111

1212
/**
1313
* Run pending tasks.

src/Command/ScheduleTaskCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function configure()
3838
->addArgument('handler', InputArgument::REQUIRED)
3939
->addArgument('workload', InputArgument::OPTIONAL)
4040
->addOption('cron-expression', 'c', InputOption::VALUE_REQUIRED)
41-
->addOption('end-date', 'e', InputOption::VALUE_REQUIRED);
41+
->addOption('end-date', null, InputOption::VALUE_REQUIRED);
4242
}
4343

4444
/**
@@ -66,6 +66,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
6666
$taskBuilder->cron($cronExpression, new \DateTime(), $endDate);
6767
}
6868

69-
$taskBuilder->schedule();
69+
$this->scheduler->addTask($taskBuilder->getTask());
7070
}
7171
}

src/DependencyInjection/TaskCompilerPass.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/DoctrineStorage/TaskExecutionRepository.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Doctrine\Common\Persistence\ObjectManager;
66
use Task\Execution\TaskExecutionInterface;
7-
use Task\Storage\TaskExecutionRepositoryInterface;
7+
use Task\Execution\TaskExecutionRepositoryInterface;
88
use Task\TaskBundle\Entity\TaskExecutionRepository as ORMTaskExecutionRepository;
99
use Task\TaskInterface;
1010

@@ -68,4 +68,9 @@ public function findAll($limit = null)
6868
{
6969
return $this->taskExecutionRepository->findBy([], ['scheduleTime' => 'ASC'], $limit);
7070
}
71+
72+
public function get($uuid)
73+
{
74+
// TODO: Implement get() method.
75+
}
7176
}

src/Entity/TaskExecutionRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function findByStartTime(TaskInterface $task, \DateTime $scheduleTime)
2222
->getQuery()
2323
->getSingleResult();
2424
} catch (NoResultException $e) {
25-
return null;
25+
return;
2626
}
2727
}
2828

src/Resources/config/command.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</service>
2020

2121
<service id="task.command.schedule_task" class="Task\TaskBundle\Command\ScheduleTaskCommand">
22-
<argument type="string">task:schedule:task</argument>
22+
<argument type="string">task:schedule</argument>
2323
<argument type="service" id="task.scheduler"/>
2424

2525
<tag name="console.command"/>

src/Resources/config/storage/array.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.storage" class="Task\Storage\ArrayStorage\ArrayTaskRepository"/>
6+
<service id="task.storage.task" class="Task\Storage\ArrayStorage\ArrayTaskRepository"/>
7+
<service id="task.storage.task_execution" class="Task\Storage\ArrayStorage\ArrayTaskExecutionRepository"/>
78
</services>
89
</container>

src/TaskBundle.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Symfony\Component\DependencyInjection\ContainerBuilder;
66
use Symfony\Component\HttpKernel\Bundle\Bundle;
77
use Task\TaskBundle\DependencyInjection\HandlerCompilerPass;
8-
use Task\TaskBundle\DependencyInjection\TaskCompilerPass;
98

109
/**
1110
* Integrates php-task into symfony.
@@ -19,6 +18,5 @@ public function build(ContainerBuilder $container)
1918
parent::build($container);
2019

2120
$container->addCompilerPass(new HandlerCompilerPass());
22-
$container->addCompilerPass(new TaskCompilerPass());
2321
}
2422
}

tests/Unit/DependencyInjection/HandlerCompilerPassTest.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

tests/Unit/DependencyInjection/TaskCompilerPassTest.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)