src/ResetableEntityManager.php
public function remove($entity)
    {
        try{
            return $this->entityManager->remove($entity);
        } catch(ORMException $e) {
            if (!$this->entityManager->isOpen()) {
                $this->resetEntityManager();
            }
            throw $e;
        }
    }
public function remove($entity)
    {
        try{
            return $this->entityManager->remove($entity);
        } catch(ORMException $e) {
            if (!$this->entityManager->isOpen()) {
                $this->resetEntityManager();
            }
            throw $e;
        }
    }
Removes an entity instance.

A removed entity will be removed from the database at or before transaction commit
or as a result of the flush operation.

@param object $entity The entity instance to remove.

@return void

@throws ORMInvalidArgumentException