示例#1
0
 /**
  * Determines whether a document instance is managed in this DocumentManager.
  *
  * @param object $document
  * @throws \InvalidArgumentException When the $document param is not an object
  * @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
 /**
  * @param object $document
  * @return boolean
  */
 private function isScheduledForInsert($document)
 {
     return $this->uow->isScheduledForInsert($document) || $this->uow->getDocumentPersister(get_class($document))->isQueuedForInsert($document);
 }