public function preFlush(PreFlushEventArgs $args)
    {
        $uow = $args->getEntityManager()->getUnitOfWork();
        $result = $uow->getIdentityMap();
        if(isset($result[$this->targetClass])) {
            foreach ($result[$this->targetClass] as $entity) {
                $this->updateEntity($entity);
            }
        }
    }
public function preFlush(PreFlushEventArgs $args)
    {
        $uow = $args->getEntityManager()->getUnitOfWork();
        $result = $uow->getIdentityMap();
        if(isset($result[$this->targetClass])) {
            foreach ($result[$this->targetClass] as $entity) {
                $this->updateEntity($entity);
            }
        }
    }
public function preFlush ( PreFlushEventArgs $ args ) { $ uow = $ args -> getEntityManager ( ) -> getUnitOfWork ( ) ; $ result = $ uow -> getIdentityMap ( ) ; if ( isset ( $ result [ $ this -> targetClass ] ) ) { foreach ( $ result [ $ this -> targetClass ] as $ entity ) { $ this -> updateEntity ( $ entity ) ; } } }
Update entity before flush to prevent a possible after flush

@param PreFlushEventArgs $args
Update entity before flush to prevent a possible after flush