1 | <?php |
||
22 | class DoctrineSubscriber implements EventSubscriber |
||
23 | { |
||
24 | use ContainerAwareTrait; |
||
25 | |||
26 | /** @var \Doctrine\Common\Annotations\Reader */ |
||
27 | private $annotationReader; |
||
28 | |||
29 | private $toBeDeleted = []; |
||
30 | |||
31 | /** |
||
32 | * @var EventDispatcher |
||
33 | */ |
||
34 | private $dispatcher; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | private $entities; |
||
40 | |||
41 | public function __construct($entities = array()) |
||
45 | |||
46 | public function getSubscribedEvents() |
||
55 | |||
56 | public function postPersist(LifecycleEventArgs $args) |
||
60 | |||
61 | public function postUpdate(LifecycleEventArgs $args) |
||
65 | |||
66 | public function preRemove(LifecycleEventArgs $args) |
||
80 | |||
81 | public function postRemove(LifecycleEventArgs $args) |
||
91 | |||
92 | private function getToBeDeletedId($entity) |
||
100 | |||
101 | /** |
||
102 | * @param string $eventName |
||
103 | * @param LifecycleEventArgs $args |
||
104 | */ |
||
105 | private function handleEvent($eventName, LifecycleEventArgs $args) |
||
113 | |||
114 | /** |
||
115 | * @param $entity |
||
116 | * @param string $eventName |
||
117 | * @return bool |
||
118 | */ |
||
119 | private function isConfiguredToTrack($entity, $eventName = '') |
||
138 | |||
139 | /** |
||
140 | * @param $entity |
||
141 | * @param string $eventType |
||
142 | * @return bool|null |
||
143 | */ |
||
144 | protected function isAnnotatedEvent($entity, $eventType) |
||
154 | |||
155 | /** |
||
156 | * @param $entity |
||
157 | * @return null|object |
||
158 | */ |
||
159 | protected function hasAnnotation($entity) |
||
168 | |||
169 | /** |
||
170 | * @return \Doctrine\Common\Annotations\Reader |
||
171 | */ |
||
172 | protected function getAnnotationReader() |
||
176 | |||
177 | /** |
||
178 | * @param $object |
||
179 | * @return \ReflectionClass |
||
180 | */ |
||
181 | protected function getReflectionClassFromObject($object) |
||
187 | |||
188 | /** |
||
189 | * @param string $eventType |
||
190 | * @param string $class |
||
191 | * @return bool |
||
192 | */ |
||
193 | private function shouldTrackEventType($eventType, $class) |
||
197 | |||
198 | /** |
||
199 | * @param string $class |
||
200 | * @return bool |
||
201 | */ |
||
202 | private function shouldTrackAllEventType($class) |
||
206 | |||
207 | /** |
||
208 | * @param string $class |
||
209 | * @return bool |
||
210 | */ |
||
211 | protected function isConfigured($class) |
||
215 | |||
216 | /** |
||
217 | * @param \Doctrine\Common\Annotations\Reader $annotationReader |
||
218 | */ |
||
219 | public function setAnnotationReader($annotationReader = null) |
||
223 | |||
224 | /** |
||
225 | * @param LifecycleEventArgs $args |
||
226 | * @param $className |
||
227 | * @return array |
||
228 | */ |
||
229 | protected function getIdentity(LifecycleEventArgs $args, $className) |
||
233 | |||
234 | /** |
||
235 | * @param $entity |
||
236 | * @return boolean |
||
237 | */ |
||
238 | private function isScheduledForDelete($entity) |
||
244 | |||
245 | /** |
||
246 | * @param EventDispatcher $dispatcher |
||
247 | */ |
||
248 | public function setDispatcher($dispatcher) |
||
252 | } |
||
253 |