diff --git a/composer.json b/composer.json index cbe3d81..149c4d5 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "symfony/config": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/process": "^5.4 || ^6.0 || ^7.0", - "doctrine/orm": "^2.5.3" + "doctrine/orm": "^2.5.3 || ^3.0" }, "require-dev": { "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", diff --git a/src/Command/ScheduleSystemTasksCommand.php b/src/Command/ScheduleSystemTasksCommand.php index f9e00ef..808e0ad 100644 --- a/src/Command/ScheduleSystemTasksCommand.php +++ b/src/Command/ScheduleSystemTasksCommand.php @@ -9,6 +9,7 @@ use Task\Scheduler\TaskSchedulerInterface; use Task\Storage\TaskExecutionRepositoryInterface; use Task\TaskBundle\Builder\TaskBuilder; +use Task\TaskBundle\Entity\SystemTaskRepositoryInterface; use Task\TaskBundle\Entity\TaskRepository; use Task\TaskInterface; use Task\TaskStatus; @@ -29,7 +30,7 @@ class ScheduleSystemTasksCommand extends Command private $scheduler; /** - * @var TaskRepository + * @var SystemTaskRepositoryInterface */ private $taskRepository; @@ -42,14 +43,14 @@ class ScheduleSystemTasksCommand extends Command * @param string $name * @param array $systemTasks * @param TaskSchedulerInterface $scheduler - * @param TaskRepository $taskRepository + * @param SystemTaskRepositoryInterface $taskRepository * @param TaskExecutionRepositoryInterface $taskExecutionRepository */ public function __construct( $name, array $systemTasks, TaskSchedulerInterface $scheduler, - TaskRepository $taskRepository, + SystemTaskRepositoryInterface $taskRepository, TaskExecutionRepositoryInterface $taskExecutionRepository ) { parent::__construct($name); diff --git a/src/Entity/SystemTaskRepositoryInterface.php b/src/Entity/SystemTaskRepositoryInterface.php new file mode 100644 index 0000000..c4ee8e5 --- /dev/null +++ b/src/Entity/SystemTaskRepositoryInterface.php @@ -0,0 +1,26 @@ + */ -class TaskRepository extends EntityRepository implements TaskRepositoryInterface +class TaskRepository extends EntityRepository implements SystemTaskRepositoryInterface { /** * {@inheritdoc} @@ -62,7 +64,7 @@ public function remove(TaskInterface $task) /** * {@inheritdoc} */ - public function findAll($page = 1, $pageSize = null) + public function findAll($page = 1, $pageSize = null): array { $query = $this->createQueryBuilder('t') ->getQuery(); @@ -100,11 +102,7 @@ public function findEndBefore(\DateTime $dateTime) } /** - * Returns task identified by system-key. - * - * @param string $systemKey - * - * @return TaskInterface + * {@inheritdoc} */ public function findBySystemKey($systemKey) { @@ -120,9 +118,7 @@ public function findBySystemKey($systemKey) } /** - * Returns all system-task. - * - * @return TaskInterface[] + * {@inheritdoc} */ public function findSystemTasks() { diff --git a/tests/Unit/Command/ScheduleSystemTasksCommandTest.php b/tests/Unit/Command/ScheduleSystemTasksCommandTest.php index c8eb9b0..6a53b51 100644 --- a/tests/Unit/Command/ScheduleSystemTasksCommandTest.php +++ b/tests/Unit/Command/ScheduleSystemTasksCommandTest.php @@ -13,8 +13,8 @@ use Task\Storage\TaskExecutionRepositoryInterface; use Task\TaskBundle\Builder\TaskBuilder; use Task\TaskBundle\Command\ScheduleSystemTasksCommand; +use Task\TaskBundle\Entity\SystemTaskRepositoryInterface; use Task\TaskBundle\Entity\Task; -use Task\TaskBundle\Entity\TaskRepository; use Task\TaskBundle\Tests\Functional\TestHandler; use Task\TaskStatus; @@ -28,7 +28,7 @@ class ScheduleSystemTasksCommandTest extends TestCase private $scheduler; /** - * @var TaskRepository + * @var SystemTaskRepositoryInterface */ private $taskRepository; @@ -40,7 +40,7 @@ class ScheduleSystemTasksCommandTest extends TestCase protected function setUp(): void { $this->scheduler = $this->prophesize(TaskSchedulerInterface::class); - $this->taskRepository = $this->prophesize(TaskRepository::class); + $this->taskRepository = $this->prophesize(SystemTaskRepositoryInterface::class); $this->taskExecutionRepository = $this->prophesize(TaskExecutionRepositoryInterface::class); }