public function postLoad(Item $item, LifecycleEventArgs $event)
    {
        $type = $this->itemDefinitions->getConvertedType($item->getMimeType());
        $definition = $this->itemDefinitions->get($type);
        $repository = $event
            ->getEntityManager()
            ->getRepository($definition->getEntityClass());

        /** @var \UJM\ExoBundle\Entity\ItemType\AbstractItem $typeEntity */
        $typeEntity = $repository->findOneBy([
            'question' => $item,
        ]);

        if (!empty($typeEntity)) {
            $item->setInteraction($typeEntity);
        }
    }
public function postLoad(Item $item, LifecycleEventArgs $event)
    {
        $type = $this->itemDefinitions->getConvertedType($item->getMimeType());
        $definition = $this->itemDefinitions->get($type);
        $repository = $event
            ->getEntityManager()
            ->getRepository($definition->getEntityClass());

        /** @var \UJM\ExoBundle\Entity\ItemType\AbstractItem $typeEntity */
        $typeEntity = $repository->findOneBy([
            'question' => $item,
        ]);

        if (!empty($typeEntity)) {
            $item->setInteraction($typeEntity);
        }
    }
public function postLoad ( Item $ item , LifecycleEventArgs $ event ) { $ type = $ this -> itemDefinitions -> getConvertedType ( $ item -> getMimeType ( ) ) ; $ definition = $ this -> itemDefinitions -> get ( $ type ) ; $ repository = $ event -> getEntityManager ( ) -> getRepository ( $ definition -> getEntityClass ( ) ) ; /** @var \UJM\ExoBundle\Entity\ItemType\AbstractItem $typeEntity */ $ typeEntity = $ repository -> findOneBy ( [ 'question' => $ item , ] ) ; if ( ! empty ( $ typeEntity ) ) { $ item -> setInteraction ( $ typeEntity ) ; } }
Loads the entity that holds the item type data when an Item is loaded.

@param Item               $item
@param LifecycleEventArgs $event
Loads the entity that holds the item type data when an Item is loaded .