/** * 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); }
/** * 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); }
/** * 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); }