| 1 | <?php |
||
| 18 | class Task |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * The entity manager. |
||
| 22 | * |
||
| 23 | * @var EntityManagerInterface |
||
| 24 | */ |
||
| 25 | protected $entityManager; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * The entity. |
||
| 29 | * |
||
| 30 | * @var TaskEntity |
||
| 31 | */ |
||
| 32 | protected $entity; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Create task object. |
||
| 36 | * |
||
| 37 | * @param EntityManagerInterface $entityManager |
||
| 38 | * @param TaskEntity $entity |
||
| 39 | */ |
||
| 40 | 8 | public function __construct(EntityManagerInterface $entityManager, TaskEntity $entity) |
|
| 45 | |||
| 46 | /** |
||
| 47 | * Get entity |
||
| 48 | * |
||
| 49 | * @return TaskEntity |
||
| 50 | */ |
||
| 51 | 2 | public function getEntity() |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Prioritize task. |
||
| 58 | * |
||
| 59 | * @param int $priority |
||
| 60 | * |
||
| 61 | * @return $this |
||
| 62 | */ |
||
| 63 | 2 | public function prioritize($priority) |
|
| 70 | |||
| 71 | /** |
||
| 72 | * Defer task. |
||
| 73 | * |
||
| 74 | * @param int $pid |
||
| 75 | * @param callable $deferrer |
||
| 76 | * |
||
| 77 | * @return $this |
||
| 78 | */ |
||
| 79 | 2 | public function defer($pid, $deferrer) |
|
| 95 | |||
| 96 | /** |
||
| 97 | * Remove task. |
||
| 98 | * |
||
| 99 | * @return $this |
||
| 100 | */ |
||
| 101 | 2 | public function remove() |
|
| 108 | } |
||
| 109 |