protected function evaluateEntityListenersAnnotation(\ReflectionClass $class, ORM\ClassMetadata $metadata, array $classAnnotations)
    {
        if (isset($classAnnotations[ORM\EntityListeners::class])) {
            $entityListenersAnnotation = $classAnnotations[ORM\EntityListeners::class];

            foreach ($entityListenersAnnotation->value as $item) {
                $listenerClassName = $metadata->fullyQualifiedClassName($item);

                if (!class_exists($listenerClassName)) {
                    throw ORM\MappingException::entityListenerClassNotFound($listenerClassName, $class->getName());
                }

                $hasMapping = false;
                foreach ($class->getMethods() as $method) {
                    if ($method->isPublic()) {
                        // find method callbacks.
                        $callbacks = $this->getMethodCallbacks($method);
                        $hasMapping = $hasMapping ?: (!empty($callbacks));

                        foreach ($callbacks as $value) {
                            $metadata->addEntityListener($value[1], $listenerClassName, $value[0]);
                        }
                    }
                }

                // Evaluate the listener using naming convention.
                if ($hasMapping === false) {
                    EntityListenerBuilder::bindEntityListener($metadata, $listenerClassName);
                }
            }
        }
    }
protected function evaluateEntityListenersAnnotation(\ReflectionClass $class, ORM\ClassMetadata $metadata, array $classAnnotations)
    {
        if (isset($classAnnotations[ORM\EntityListeners::class])) {
            $entityListenersAnnotation = $classAnnotations[ORM\EntityListeners::class];

            foreach ($entityListenersAnnotation->value as $item) {
                $listenerClassName = $metadata->fullyQualifiedClassName($item);

                if (!class_exists($listenerClassName)) {
                    throw ORM\MappingException::entityListenerClassNotFound($listenerClassName, $class->getName());
                }

                $hasMapping = false;
                foreach ($class->getMethods() as $method) {
                    if ($method->isPublic()) {
                        // find method callbacks.
                        $callbacks = $this->getMethodCallbacks($method);
                        $hasMapping = $hasMapping ?: (!empty($callbacks));

                        foreach ($callbacks as $value) {
                            $metadata->addEntityListener($value[1], $listenerClassName, $value[0]);
                        }
                    }
                }

                // Evaluate the listener using naming convention.
                if ($hasMapping === false) {
                    EntityListenerBuilder::bindEntityListener($metadata, $listenerClassName);
                }
            }
        }
    }
protected function evaluateEntityListenersAnnotation ( \ ReflectionClass $ class , ORM \ ClassMetadata $ metadata , array $ classAnnotations ) { if ( isset ( $ classAnnotations [ ORM \ EntityListeners :: class ] ) ) { $ entityListenersAnnotation = $ classAnnotations [ ORM \ EntityListeners :: class ] ; foreach ( $ entityListenersAnnotation -> value as $ item ) { $ listenerClassName = $ metadata -> fullyQualifiedClassName ( $ item ) ; if ( ! class_exists ( $ listenerClassName ) ) { throw ORM \ MappingException :: entityListenerClassNotFound ( $ listenerClassName , $ class -> getName ( ) ) ; } $ hasMapping = false ; foreach ( $ class -> getMethods ( ) as $ method ) { if ( $ method -> isPublic ( ) ) { // find method callbacks. $ callbacks = $ this -> getMethodCallbacks ( $ method ) ; $ hasMapping = $ hasMapping ? : ( ! empty ( $ callbacks ) ) ; foreach ( $ callbacks as $ value ) { $ metadata -> addEntityListener ( $ value [ 1 ] , $ listenerClassName , $ value [ 0 ] ) ; } } } // Evaluate the listener using naming convention. if ( $ hasMapping === false ) { EntityListenerBuilder :: bindEntityListener ( $ metadata , $ listenerClassName ) ; } } } }
Evaluate the EntityListeners annotation and amend the metadata accordingly.

@param \ReflectionClass $class
@param ORM\ClassMetadata $metadata
@param array $classAnnotations
@return void
@throws ORM\MappingException
Evaluate the EntityListeners annotation and amend the metadata accordingly .