Esempio n. 1
0
 /**
  * Clears the UnitOfWork.
  *
  * @param string|null $entityName if given, only entities of this type will get detached.
  *
  * @return void
  */
 public function clear($entityName = null)
 {
     if ($entityName === null) {
         $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->readOnlyObjects = $this->visitedCollections = $this->orphanRemovals = array();
         if ($this->commitOrderCalculator !== null) {
             $this->commitOrderCalculator->clear();
         }
     } else {
         $visited = array();
         foreach ($this->identityMap as $className => $entities) {
             if ($className !== $entityName) {
                 continue;
             }
             foreach ($entities as $entity) {
                 $this->doDetach($entity, $visited, false);
             }
         }
     }
     if ($this->evm->hasListeners(Events::onClear)) {
         $this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->em, $entityName));
     }
 }
Esempio n. 2
0
 /**
  * Clears the UnitOfWork.
  */
 public function clear()
 {
     $this->_identityMap = array();
     $this->_entityIdentifiers = array();
     $this->_originalEntityData = array();
     $this->_entityChangeSets = array();
     $this->_entityStates = array();
     $this->_scheduledForDirtyCheck = array();
     $this->_entityInsertions = array();
     $this->_entityUpdates = array();
     $this->_entityDeletions = array();
     $this->_collectionDeletions = array();
     $this->_collectionCreations = array();
     $this->_collectionUpdates = array();
     $this->_commitOrderCalculator->clear();
 }
 /**
  * Clears the UnitOfWork.
  */
 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->readOnlyObjects = $this->orphanRemovals = array();
     if ($this->commitOrderCalculator !== null) {
         $this->commitOrderCalculator->clear();
     }
     if ($this->evm->hasListeners(Events::onClear)) {
         $this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->em));
     }
 }
Esempio n. 4
0
 /**
  * Clears the UnitOfWork.
  *
  * @param string|null $entityName if given, only entities of this type will get detached.
  *
  * @return void
  */
 public function clear($entityName = null)
 {
     if ($entityName === null) {
         $this->identityMap = $this->entityIdentifiers = $this->originalEntityData = $this->entityChangeSets = $this->entityStates = $this->scheduledForSynchronization = $this->entityInsertions = $this->entityUpdates = $this->entityDeletions = $this->collectionDeletions = $this->collectionUpdates = $this->extraUpdates = $this->readOnlyObjects = $this->visitedCollections = $this->orphanRemovals = array();
         if ($this->commitOrderCalculator !== null) {
             $this->commitOrderCalculator->clear();
         }
     } else {
         $this->clearIdentityMapForEntityName($entityName);
         $this->clearEntityInsertionsForEntityName($entityName);
     }
     if ($this->evm->hasListeners(Events::onClear)) {
         $this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->em, $entityName));
     }
 }