src/Entity/EntityCustomField.php
public function loadEntitiesAtLoad(LifecycleEventArgs $event)
    {
        if ($this->entityValue && $this->entityValue['entityClass']) {
            $em = $event->getEntityManager();
            if (is_array($this->entityValue) && is_array($this->entityValue['entityId'])) {
                // multiple
                $entityData = $em->getRepository($this->entityValue['entityClass'])->findById($this->entityValue['entityId']); // in this case, $this->entityValue['entityId'] contains an array of entity IDs
            } else {
                // single
                $entityData = $em->getRepository($this->entityValue['entityClass'])->findOneById($this->entityValue['entityId']);
            }

            $this->entityData = $entityData;
        } else {
            $this->entityData = null;
        }
    }
public function loadEntitiesAtLoad(LifecycleEventArgs $event)
    {
        if ($this->entityValue && $this->entityValue['entityClass']) {
            $em = $event->getEntityManager();
            if (is_array($this->entityValue) && is_array($this->entityValue['entityId'])) {
                // multiple
                $entityData = $em->getRepository($this->entityValue['entityClass'])->findById($this->entityValue['entityId']); // in this case, $this->entityValue['entityId'] contains an array of entity IDs
            } else {
                // single
                $entityData = $em->getRepository($this->entityValue['entityClass'])->findOneById($this->entityValue['entityId']);
            }

            $this->entityData = $entityData;
        } else {
            $this->entityData = null;
        }
    }
public function loadEntitiesAtLoad ( LifecycleEventArgs $ event ) { if ( $ this -> entityValue && $ this -> entityValue [ 'entityClass' ] ) { $ em = $ event -> getEntityManager ( ) ; if ( is_array ( $ this -> entityValue ) && is_array ( $ this -> entityValue [ 'entityId' ] ) ) { // multiple $ entityData = $ em -> getRepository ( $ this -> entityValue [ 'entityClass' ] ) -> findById ( $ this -> entityValue [ 'entityId' ] ) ; // in this case, $this->entityValue['entityId'] contains an array of entity IDs } else { // single $ entityData = $ em -> getRepository ( $ this -> entityValue [ 'entityClass' ] ) -> findOneById ( $ this -> entityValue [ 'entityId' ] ) ; } $ this -> entityData = $ entityData ; } else { $ this -> entityData = null ; } }
LifeCycleCallback PostLoad, loading entities from DataBase.

@ORM\PostLoad

@param LifecycleEventArgs $event
LifeCycleCallback PostLoad loading entities from DataBase .