public function preFlush(PreFlushEventArgs $eventArgs)
    {
        $entityManager = $eventArgs->getEntityManager();
        $unitOfWork = $entityManager->getUnitOfWork();

        foreach ($unitOfWork->getScheduledEntityInsertions() as $object) {
            $this->updateObjectTranslations($entityManager, $object);
        }

        foreach ($unitOfWork->getIdentityMap() as $entities) {
            foreach ($entities as $object) {
                $this->updateObjectTranslations($entityManager, $object);
            }
        }
    }
public function preFlush(PreFlushEventArgs $eventArgs)
    {
        $entityManager = $eventArgs->getEntityManager();
        $unitOfWork = $entityManager->getUnitOfWork();

        foreach ($unitOfWork->getScheduledEntityInsertions() as $object) {
            $this->updateObjectTranslations($entityManager, $object);
        }

        foreach ($unitOfWork->getIdentityMap() as $entities) {
            foreach ($entities as $object) {
                $this->updateObjectTranslations($entityManager, $object);
            }
        }
    }
public function preFlush ( PreFlushEventArgs $ eventArgs ) { $ entityManager = $ eventArgs -> getEntityManager ( ) ; $ unitOfWork = $ entityManager -> getUnitOfWork ( ) ; foreach ( $ unitOfWork -> getScheduledEntityInsertions ( ) as $ object ) { $ this -> updateObjectTranslations ( $ entityManager , $ object ) ; } foreach ( $ unitOfWork -> getIdentityMap ( ) as $ entities ) { foreach ( $ entities as $ object ) { $ this -> updateObjectTranslations ( $ entityManager , $ object ) ; } } }
This event handler will update, insert or remove translation entities if
main object's translatable properties change.

@param PreFlushEventArgs $eventArgs
This event handler will update insert or remove translation entities if main object s translatable properties change .