Doctrine\ORM\UnitOfWork::clear PHP Method

clear() public method

Clears the UnitOfWork.
public clear ( )
    public function clear()
    {
        $this->identityMap =
        $this->entityIdentifiers =
        $this->originalEntityData =
        $this->entityChangeSets =
        $this->entityStates =
        $this->scheduledForDirtyCheck =
        $this->entityInsertions =
        $this->entityUpdates =
        $this->entityDeletions =
        $this->collectionDeletions =
        $this->collectionUpdates =
        $this->extraUpdates =
        $this->orphanRemovals = array();
        if ($this->commitOrderCalculator !== null) {
            $this->commitOrderCalculator->clear();
        }
    }

Usage Example

 /**
  * Clears the EntityManager. All entities that are currently managed
  * by this EntityManager become detached.
  *
  * @param string $entityName
  */
 public function clear($entityName = null)
 {
     if ($entityName === null) {
         $this->unitOfWork->clear();
     } else {
         //TODO
         throw new ORMException("EntityManager#clear(\$entityName) not yet implemented.");
     }
 }
All Usage Examples Of Doctrine\ORM\UnitOfWork::clear