public function preFlush(PreFlushEventArgs $args)
    {
        $scheduledInsertions = $args
            ->getEntityManager()
            ->getUnitOfWork()
            ->getScheduledEntityInsertions();

        foreach ($scheduledInsertions as $entity) {
            if ($entity instanceof CategoryInterface) {
                $this->removeParentCategoryForRootCategory($entity);
            }
        }

        return $this;
    }
public function preFlush(PreFlushEventArgs $args)
    {
        $scheduledInsertions = $args
            ->getEntityManager()
            ->getUnitOfWork()
            ->getScheduledEntityInsertions();

        foreach ($scheduledInsertions as $entity) {
            if ($entity instanceof CategoryInterface) {
                $this->removeParentCategoryForRootCategory($entity);
            }
        }

        return $this;
    }
public function preFlush ( PreFlushEventArgs $ args ) { $ scheduledInsertions = $ args -> getEntityManager ( ) -> getUnitOfWork ( ) -> getScheduledEntityInsertions ( ) ; foreach ( $ scheduledInsertions as $ entity ) { if ( $ entity instanceof CategoryInterface ) { $ this -> removeParentCategoryForRootCategory ( $ entity ) ; } } return $ this ; }
Pre flush event listener.

@param PreFlushEventArgs $args The pre flush event args.

@return $this Self object
Pre flush event listener .