1 | <?php |
||
21 | class DoctrineSubscriber implements ContainerAwareInterface, EventSubscriber |
||
22 | { |
||
23 | use ContainerAwareTrait; |
||
24 | |||
25 | /** @var \Doctrine\Common\Annotations\Reader */ |
||
26 | private $annotationReader; |
||
27 | |||
28 | private $toBeDeleted = []; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $entities; |
||
34 | |||
35 | public function __construct($entities = array()) |
||
39 | |||
40 | public function getSubscribedEvents() |
||
49 | |||
50 | public function postPersist(LifecycleEventArgs $args) |
||
54 | |||
55 | public function postUpdate(LifecycleEventArgs $args) |
||
59 | |||
60 | public function preRemove(LifecycleEventArgs $args) |
||
74 | |||
75 | public function postRemove(LifecycleEventArgs $args) |
||
85 | |||
86 | private function getToBeDeletedId($entity) |
||
94 | |||
95 | /** |
||
96 | * @param string $eventName |
||
97 | * @param LifecycleEventArgs $args |
||
98 | */ |
||
99 | private function handleEvent($eventName, LifecycleEventArgs $args) |
||
107 | |||
108 | /** |
||
109 | * @param $entity |
||
110 | * @param string $eventName |
||
111 | * @return bool |
||
112 | */ |
||
113 | private function isConfiguredToTrack($entity, $eventName = '') |
||
132 | |||
133 | /** |
||
134 | * @param $entity |
||
135 | * @param string $eventType |
||
136 | * @return bool|null |
||
137 | */ |
||
138 | protected function isAnnotatedEvent($entity, $eventType) |
||
148 | |||
149 | /** |
||
150 | * @param $entity |
||
151 | * @return null|object |
||
152 | */ |
||
153 | protected function hasAnnotation($entity) |
||
162 | |||
163 | /** |
||
164 | * @return \Doctrine\Common\Annotations\Reader |
||
165 | */ |
||
166 | protected function getAnnotationReader() |
||
170 | |||
171 | /** |
||
172 | * @param $object |
||
173 | * @return \ReflectionClass |
||
174 | */ |
||
175 | protected function getReflectionClassFromObject($object) |
||
181 | |||
182 | /** |
||
183 | * @param string $eventType |
||
184 | * @param string $class |
||
185 | * @return bool |
||
186 | */ |
||
187 | private function shouldTrackEventType($eventType, $class) |
||
191 | |||
192 | /** |
||
193 | * @param string $class |
||
194 | * @return bool |
||
195 | */ |
||
196 | private function shouldTrackAllEventType($class) |
||
200 | |||
201 | /** |
||
202 | * @param string $class |
||
203 | * @return bool |
||
204 | */ |
||
205 | protected function isConfigured($class) |
||
209 | |||
210 | /** |
||
211 | * @param \Doctrine\Common\Annotations\Reader $annotationReader |
||
212 | */ |
||
213 | public function setAnnotationReader($annotationReader = null) |
||
217 | |||
218 | /** |
||
219 | * @param LifecycleEventArgs $args |
||
220 | * @param $className |
||
221 | * @return array |
||
222 | */ |
||
223 | protected function getIdentity(LifecycleEventArgs $args, $className) |
||
227 | } |
||
228 |