@@ 293-316 (lines=24) @@ | ||
290 | } |
|
291 | ||
292 | // Evaluate @EntityListeners annotation |
|
293 | if (isset($classAnnotations[Annotation\EntityListeners::class])) { |
|
294 | /** @var Annotation\EntityListeners $entityListenersAnnot */ |
|
295 | $entityListenersAnnot = $classAnnotations[Annotation\EntityListeners::class]; |
|
296 | ||
297 | foreach ($entityListenersAnnot->value as $item) { |
|
298 | $listenerClassName = $classMetadata->fullyQualifiedClassName($item); |
|
299 | ||
300 | if (! class_exists($listenerClassName)) { |
|
301 | throw Mapping\MappingException::entityListenerClassNotFound( |
|
302 | $listenerClassName, |
|
303 | $reflectionClass->getName() |
|
304 | ); |
|
305 | } |
|
306 | ||
307 | $listenerClass = new \ReflectionClass($listenerClassName); |
|
308 | ||
309 | /* @var $method \ReflectionMethod */ |
|
310 | foreach ($listenerClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { |
|
311 | foreach ($this->getMethodCallbacks($method) as $callback) { |
|
312 | $classMetadata->addEntityListener($callback, $listenerClassName, $method->getName()); |
|
313 | } |
|
314 | } |
|
315 | } |
|
316 | } |
|
317 | ||
318 | // Evaluate @HasLifecycleCallbacks annotation |
|
319 | if (isset($classAnnotations[Annotation\HasLifecycleCallbacks::class])) { |
@@ 393-416 (lines=24) @@ | ||
390 | } |
|
391 | ||
392 | // Evaluate @EntityListeners annotation |
|
393 | if (isset($classAnnotations[Annotation\EntityListeners::class])) { |
|
394 | /** @var Annotation\EntityListeners $entityListenersAnnot */ |
|
395 | $entityListenersAnnot = $classAnnotations[Annotation\EntityListeners::class]; |
|
396 | ||
397 | foreach ($entityListenersAnnot->value as $item) { |
|
398 | $listenerClassName = $metadata->fullyQualifiedClassName($item); |
|
399 | ||
400 | if (! class_exists($listenerClassName)) { |
|
401 | throw Mapping\MappingException::entityListenerClassNotFound( |
|
402 | $listenerClassName, |
|
403 | $classMetadata->getClassName() |
|
404 | ); |
|
405 | } |
|
406 | ||
407 | $listenerClass = new \ReflectionClass($listenerClassName); |
|
408 | ||
409 | /* @var $method \ReflectionMethod */ |
|
410 | foreach ($listenerClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { |
|
411 | foreach ($this->getMethodCallbacks($method) as $callback) { |
|
412 | $classMetadata->addEntityListener($callback, $listenerClassName, $method->getName()); |
|
413 | } |
|
414 | } |
|
415 | } |
|
416 | } |
|
417 | ||
418 | // Evaluate @HasLifecycleCallbacks annotation |
|
419 | if (isset($classAnnotations[Annotation\HasLifecycleCallbacks::class])) { |