public static function onInclude(Event $event)
    {
        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            if (null === $em = $dispatcher->getApplication()->getEntityManager()) {
                return;
            }

            $shortClassname = AbstractClassContent::getShortClassname($event->getTarget());
            $fullClassname = AbstractClassContent::getFullClassname($event->getTarget());
            foreach (class_parents($fullClassname) as $classname) {
                $em->getClassMetadata($classname)->addDiscriminatorMapClass($shortClassname, $fullClassname);

                if ('BackBee\ClassContent\AbstractClassContent' === $classname) {
                    break;
                }
            }
        }
    }
public static function onInclude(Event $event)
    {
        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            if (null === $em = $dispatcher->getApplication()->getEntityManager()) {
                return;
            }

            $shortClassname = AbstractClassContent::getShortClassname($event->getTarget());
            $fullClassname = AbstractClassContent::getFullClassname($event->getTarget());
            foreach (class_parents($fullClassname) as $classname) {
                $em->getClassMetadata($classname)->addDiscriminatorMapClass($shortClassname, $fullClassname);

                if ('BackBee\ClassContent\AbstractClassContent' === $classname) {
                    break;
                }
            }
        }
    }
public static function onInclude ( Event $ event ) { $ dispatcher = $ event -> getDispatcher ( ) ; if ( null !== $ dispatcher -> getApplication ( ) ) { if ( null === $ em = $ dispatcher -> getApplication ( ) -> getEntityManager ( ) ) { return ; } $ shortClassname = AbstractClassContent :: getShortClassname ( $ event -> getTarget ( ) ) ; $ fullClassname = AbstractClassContent :: getFullClassname ( $ event -> getTarget ( ) ) ; foreach ( class_parents ( $ fullClassname ) as $ classname ) { $ em -> getClassMetadata ( $ classname ) -> addDiscriminatorMapClass ( $ shortClassname , $ fullClassname ) ; if ( 'BackBee\ClassContent\AbstractClassContent' === $ classname ) { break ; } } } }
Add discriminator values to class MetaData when a content class is loaded
Occur on classcontent.include events.

@param Event $event
Add discriminator values to class MetaData when a content class is loaded Occur on classcontent . include events .