isInIdentityMap() 공개 메소드

Checks whether a document is registered in the identity map.
public isInIdentityMap ( object $document ) : boolean
$document object
리턴 boolean
예제 #1
0
 /**
  * Determines whether a document instance is managed in this DocumentManager.
  *
  * @param object $document
  * @return boolean TRUE if this DocumentManager currently manages the given document, FALSE otherwise.
  */
 public function contains($document)
 {
     if (!is_object($document)) {
         throw new \InvalidArgumentException(gettype($document));
     }
     return $this->unitOfWork->isScheduledForInsert($document) || $this->unitOfWork->isInIdentityMap($document) && !$this->unitOfWork->isScheduledForDelete($document);
 }
예제 #2
0
 /**
  * Returns the value of the identifier field of a document
  *
  * Doctrine must know about this document, that is, the document must already
  * be persisted or added to the identity map before. Otherwise an
  * exception is thrown.
  *
  * @param  object $document  The document for which to get the identifier
  * @throws FormException   If the document does not exist in Doctrine's
  *                         identity map
  */
 public function getIdentifierValue($document)
 {
     if (!$this->unitOfWork->isInIdentityMap($document)) {
         throw new FormException('documents passed to the choice field must be managed');
     }
     return $this->unitOfWork->getDocumentIdentifier($document);
 }
예제 #3
0
 /**
  * Determines whether a document instance is managed in this DocumentManager.
  *
  * @param object $document
  * @return boolean TRUE if this DocumentManager currently manages the given document, FALSE otherwise.
  */
 public function contains($document)
 {
     return $this->unitOfWork->isScheduledForInsert($document) || $this->unitOfWork->isInIdentityMap($document) && !$this->unitOfWork->isScheduledForDelete($document);
 }