1 | <?php |
||
11 | class DoctrineStorage implements StorageInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var EntityManagerInterface |
||
15 | */ |
||
16 | private $entityManager; |
||
17 | |||
18 | /** |
||
19 | * @var TaskRepository |
||
20 | */ |
||
21 | private $taskRepository; |
||
22 | |||
23 | 102 | public function __construct(EntityManagerInterface $entityManager, TaskRepository $taskRepository) |
|
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | 100 | public function store(TaskInterface $task) |
|
33 | { |
||
34 | 100 | $entity = new TaskEntity(); |
|
35 | |||
36 | 100 | if ($task->getKey()) { |
|
|
|||
37 | 48 | $oldEntity = $this->taskRepository->findOneBy( |
|
38 | [ |
||
39 | 48 | 'key' => $task->getKey(), |
|
40 | 40 | 'completed' => false, |
|
41 | ] |
||
42 | 40 | ); |
|
43 | |||
44 | 48 | if ($oldEntity) { |
|
45 | // TODO update task (warning execution date should not be changed) |
||
46 | |||
47 | 24 | return; |
|
48 | } |
||
49 | 20 | } |
|
50 | |||
51 | 76 | $this->setTask($entity, $task); |
|
52 | |||
53 | 76 | $this->entityManager->persist($entity); |
|
54 | 76 | $this->entityManager->flush(); |
|
55 | 76 | } |
|
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 4 | public function findScheduled() |
|
61 | { |
||
62 | 4 | return array_map( |
|
63 | function (TaskEntity $entity) { |
||
64 | 4 | return $entity->getTask(); |
|
65 | 4 | }, |
|
66 | 4 | $this->taskRepository->findScheduled() |
|
67 | 4 | ); |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 2 | public function findAll() |
|
74 | { |
||
75 | 2 | return array_map( |
|
76 | 2 | function (TaskEntity $entity) { |
|
77 | 2 | return $entity->getTask(); |
|
78 | 2 | }, |
|
79 | 2 | $this->taskRepository->findAll() |
|
80 | 2 | ); |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | 2 | public function persist(TaskInterface $task) |
|
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 4 | public function clear() |
|
103 | |||
104 | 76 | private function setTask(TaskEntity $entity, TaskInterface $task) |
|
112 | } |
||
113 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.