src/Entity/Factory/EntityFactory.php
public function initialiseEntity(EntityInterface $entity): void
    {
        $entity->ensureMetaDataIsSet($this->entityManager);
        $this->addListenerToEntityIfRequired($entity);
        $this->entityDependencyInjector->injectEntityDependencies($entity);
        $debugInitMethod = $entity::getDoctrineStaticMeta()
                                  ->getReflectionClass()
                                  ->getMethod(UsesPHPMetaDataInterface::METHOD_DEBUG_INIT);
        $debugInitMethod->setAccessible(true);
        $debugInitMethod->invoke($entity);
    }
public function initialiseEntity(EntityInterface $entity): void
    {
        $entity->ensureMetaDataIsSet($this->entityManager);
        $this->addListenerToEntityIfRequired($entity);
        $this->entityDependencyInjector->injectEntityDependencies($entity);
        $debugInitMethod = $entity::getDoctrineStaticMeta()
                                  ->getReflectionClass()
                                  ->getMethod(UsesPHPMetaDataInterface::METHOD_DEBUG_INIT);
        $debugInitMethod->setAccessible(true);
        $debugInitMethod->invoke($entity);
    }
public function initialiseEntity ( EntityInterface $ entity ) : void { $ entity -> ensureMetaDataIsSet ( $ this -> entityManager ) ; $ this -> addListenerToEntityIfRequired ( $ entity ) ; $ this -> entityDependencyInjector -> injectEntityDependencies ( $ entity ) ; $ debugInitMethod = $ entity :: getDoctrineStaticMeta ( ) -> getReflectionClass ( ) -> getMethod ( UsesPHPMetaDataInterface :: METHOD_DEBUG_INIT ) ; $ debugInitMethod -> setAccessible ( true ) ; $ debugInitMethod -> invoke ( $ entity ) ; }
Take an already instantiated Entity and perform the final initialisation steps

@param EntityInterface $entity
Take an already instantiated Entity and perform the final initialisation steps