Пример #1
0
 /**
  * Clears the UnitOfWork.
  *
  * @param string $documentName if given, only documents of this type will get detached
  */
 public function clear($documentName = null)
 {
     if ($documentName === null) {
         $this->identityMap = $this->documentIdentifiers = $this->originalDocumentData = $this->documentChangeSets = $this->documentStates = $this->scheduledForDirtyCheck = $this->documentInsertions = $this->documentUpdates = $this->documentDeletions = $this->collectionUpdates = $this->collectionDeletions = $this->extraUpdates = $this->parentAssociations = $this->orphanRemovals = array();
         if ($this->commitOrderCalculator !== null) {
             $this->commitOrderCalculator->clear();
         }
     } else {
         $visited = array();
         foreach ($this->identityMap as $className => $documents) {
             if ($className === $documentName) {
                 foreach ($documents as $document) {
                     $this->doDetach($document, $visited, true);
                 }
             }
         }
     }
     if ($this->evm->hasListeners(Events::onClear)) {
         $this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->dm, $documentName));
     }
 }
Пример #2
0
 /**
  * Clears the UnitOfWork.
  */
 public function clear()
 {
     $this->identityMap = $this->documentIdentifiers = $this->originalDocumentData = $this->documentChangeSets = $this->documentStates = $this->scheduledForDirtyCheck = $this->documentInsertions = $this->documentUpdates = $this->documentDeletions = $this->collectionUpdates = $this->collectionDeletions = $this->extraUpdates = $this->parentAssociations = $this->orphanRemovals = array();
     if ($this->commitOrderCalculator !== null) {
         $this->commitOrderCalculator->clear();
     }
 }
 /**
  * Clears the UnitOfWork.
  */
 public function clear()
 {
     $this->_identityMap = $this->_documentIdentifiers = $this->_originalDocumentData = $this->_documentChangeSets = $this->_documentStates = $this->_scheduledForDirtyCheck = $this->_documentInsertions = $this->_documentUpdates = $this->_documentDeletions = $this->_orphanRemovals = array();
     if ($this->_commitOrderCalculator !== null) {
         $this->_commitOrderCalculator->clear();
     }
 }