1 | <?php |
||
19 | class TaskManager |
||
20 | { |
||
21 | /** |
||
22 | * The entity manager. |
||
23 | * |
||
24 | * @var EntityManagerInterface |
||
25 | */ |
||
26 | protected $entityManager; |
||
27 | |||
28 | /** |
||
29 | * The repository. |
||
30 | * |
||
31 | * @var TaskEntityRepository |
||
32 | */ |
||
33 | protected $repository; |
||
34 | |||
35 | /** |
||
36 | * Create task manager object. |
||
37 | * |
||
38 | * @param EntityManagerInterface $entityManager |
||
39 | */ |
||
40 | 14 | public function __construct(EntityManagerInterface $entityManager) |
|
44 | |||
45 | /** |
||
46 | * Get repository. |
||
47 | * |
||
48 | * @return TaskEntityRepository |
||
49 | */ |
||
50 | 10 | public function getRepository() |
|
58 | |||
59 | /** |
||
60 | * Map entities. |
||
61 | * |
||
62 | * @param TaskEntity[] $entities |
||
63 | * |
||
64 | * @return Task[] |
||
65 | */ |
||
66 | protected function mapEntities(array $entities) |
||
72 | |||
73 | /** |
||
74 | * Find all tasks. |
||
75 | * |
||
76 | * @return Task[] |
||
77 | */ |
||
78 | 2 | public function findAllTasks() |
|
82 | |||
83 | /** |
||
84 | * Find all terminated tasks. |
||
85 | * |
||
86 | * @return Task[] |
||
87 | */ |
||
88 | 2 | public function findAllTerminatedTasks() |
|
92 | |||
93 | /** |
||
94 | * Find next task. |
||
95 | * |
||
96 | * @param array $criteria |
||
97 | * |
||
98 | * @return Task|null |
||
99 | */ |
||
100 | 4 | public function findNextTask(array $criteria = []) |
|
109 | |||
110 | /** |
||
111 | * Create and persist new task. |
||
112 | * |
||
113 | * @param string $commandline |
||
114 | * @param int|null $priority |
||
115 | * |
||
116 | * @return Task |
||
117 | */ |
||
118 | 4 | public function newTask($commandline, $priority = null) |
|
133 | } |
||
134 |