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 ObjectRepository |
||
32 | */ |
||
33 | protected $repository; |
||
34 | |||
35 | /** |
||
36 | * Create task manager object. |
||
37 | * |
||
38 | * @param EntityManagerInterface $entityManager |
||
39 | */ |
||
40 | public function __construct(EntityManagerInterface $entityManager) |
||
44 | |||
45 | /** |
||
46 | * Get repository. |
||
47 | * |
||
48 | * @return ObjectRepository |
||
49 | */ |
||
50 | public function getRepository() |
||
58 | |||
59 | /** |
||
60 | * Get all tasks. |
||
61 | * |
||
62 | * @param array $criteria |
||
63 | * |
||
64 | * @return Task[] |
||
65 | */ |
||
66 | public function getTasks(array $criteria = []) |
||
72 | |||
73 | /** |
||
74 | * Get single task by criteria. |
||
75 | * |
||
76 | * @param array $criteria |
||
77 | * |
||
78 | * @return null|Task |
||
79 | */ |
||
80 | public function getTask(array $criteria) |
||
90 | |||
91 | /** |
||
92 | * Add task. |
||
93 | * |
||
94 | * @param string $script |
||
95 | * @param int $priority |
||
96 | * |
||
97 | * @return Task |
||
98 | */ |
||
99 | public function addTask($script, $priority = TaskEntity::DEFAULT_PRIORITY) |
||
110 | } |
||
111 |