public function onFlush(OnFlushEventArgs $event)
    {
        $uow = $event->getEntityManager()->getUnitOfWork();

        foreach ($uow->getScheduledEntityInsertions() as $entity) {
            if ($entity instanceof DataInterface
                && $this->hasCreatedEntity(
                    $entity->getFamily(),
                    $entity->getIdentifier()
                )
            ) {
                $this->removeCreatedEntity($entity->getFamily(), $entity->getIdentifier());
            }
        }
    }
public function onFlush(OnFlushEventArgs $event)
    {
        $uow = $event->getEntityManager()->getUnitOfWork();

        foreach ($uow->getScheduledEntityInsertions() as $entity) {
            if ($entity instanceof DataInterface
                && $this->hasCreatedEntity(
                    $entity->getFamily(),
                    $entity->getIdentifier()
                )
            ) {
                $this->removeCreatedEntity($entity->getFamily(), $entity->getIdentifier());
            }
        }
    }
public function onFlush ( OnFlushEventArgs $ event ) { $ uow = $ event -> getEntityManager ( ) -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { if ( $ entity instanceof DataInterface && $ this -> hasCreatedEntity ( $ entity -> getFamily ( ) , $ entity -> getIdentifier ( ) ) ) { $ this -> removeCreatedEntity ( $ entity -> getFamily ( ) , $ entity -> getIdentifier ( ) ) ; } } }
When an entity is created, we don't need to keep the reference anymore

@param OnFlushEventArgs $event

@throws \Sidus\EAVModelBundle\Exception\InvalidValueDataException
When an entity is created we don t need to keep the reference anymore