public function preFlush(PreFlushEventArgs $event)
    {
        $entityManager = $event->getEntityManager();
        $uow = $entityManager->getUnitOfWork();

        foreach ($uow->getIdentityMap() as $class => $entities) {
            foreach ($entities as $entity) {
                if ($entity instanceof DeletableInterface) {
                    if ($entity->isDeleted()) {
                        $entityManager->remove($entity);
                    }
                }
            }
        }
    }
public function preFlush(PreFlushEventArgs $event)
    {
        $entityManager = $event->getEntityManager();
        $uow = $entityManager->getUnitOfWork();

        foreach ($uow->getIdentityMap() as $class => $entities) {
            foreach ($entities as $entity) {
                if ($entity instanceof DeletableInterface) {
                    if ($entity->isDeleted()) {
                        $entityManager->remove($entity);
                    }
                }
            }
        }
    }
public function preFlush ( PreFlushEventArgs $ event ) { $ entityManager = $ event -> getEntityManager ( ) ; $ uow = $ entityManager -> getUnitOfWork ( ) ; foreach ( $ uow -> getIdentityMap ( ) as $ class => $ entities ) { foreach ( $ entities as $ entity ) { if ( $ entity instanceof DeletableInterface ) { if ( $ entity -> isDeleted ( ) ) { $ entityManager -> remove ( $ entity ) ; } } } } }
Remove entities marked as deleted

@param PreFlushEventArgs $event
Remove entities marked as deleted