1 | <?php |
||
20 | class DoctrineListener implements EventSubscriber { |
||
21 | |||
22 | /** |
||
23 | * |
||
24 | * @var EntityToDocumentMapperInterface |
||
25 | */ |
||
26 | protected $entityToDocumentMapper; |
||
27 | |||
28 | /** |
||
29 | * |
||
30 | * @var SearchService |
||
31 | */ |
||
32 | protected $searchService; |
||
33 | |||
34 | protected $needsFlush = false; |
||
35 | |||
36 | protected $enableIndexing; |
||
37 | |||
38 | public function getSubscribedEvents() { |
||
46 | |||
47 | /** |
||
48 | * Constructor |
||
49 | * |
||
50 | * @param SearchService $searchService |
||
51 | */ |
||
52 | public function __construct(EntityToDocumentMapperInterface $entityToDocumentMapper, SearchService $searchService, $enableIndexing = true) { |
||
57 | |||
58 | public function enableIndexing() { |
||
61 | |||
62 | public function disableIndexing() { |
||
65 | |||
66 | public function isIndexingEnabled() { |
||
69 | |||
70 | /** |
||
71 | * Index the entity after it is persisted for the first time |
||
72 | * |
||
73 | * @param LifecycleEventArgs $args |
||
74 | */ |
||
75 | public function postPersist(LifecycleEventArgs $args) { |
||
79 | |||
80 | public function postFlush(PostFlushEventArgs $eventArgs) { |
||
86 | |||
87 | /** |
||
88 | * Removes the entity from the index when it marked for deletion |
||
89 | * |
||
90 | * @param LifecycleEventArgs $args |
||
91 | */ |
||
92 | public function preRemove(LifecycleEventArgs $args) { |
||
96 | |||
97 | /** |
||
98 | * Updates the entity in the index after it is updated |
||
99 | * |
||
100 | * @param LifecycleEventArgs $args |
||
101 | */ |
||
102 | public function postUpdate(LifecycleEventArgs $args) { |
||
106 | |||
107 | /** |
||
108 | * |
||
109 | * @return EntityToDocumentMapperInterface |
||
110 | */ |
||
111 | protected function getEntityToDocumentMapper() { |
||
114 | |||
115 | /** |
||
116 | * |
||
117 | * @return SearchService |
||
118 | */ |
||
119 | protected function getSearchService(ObjectManager $manager) { |
||
123 | |||
124 | /** |
||
125 | * |
||
126 | * @param object $entity |
||
127 | */ |
||
128 | protected function updateEntity($entity, ObjectManager $manager) { |
||
134 | |||
135 | /** |
||
136 | * |
||
137 | * @param object $entity |
||
138 | */ |
||
139 | protected function removeEntity($entity, ObjectManager $manager) { |
||
145 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.