/** * Merges the state of a detached document into the persistence context * of this DocumentManager and returns the managed copy of the document. * The document passed to merge will not become associated/managed with this DocumentManager. * * @param object $document The detached document to merge into the persistence context. * @throws LockException * @throws \InvalidArgumentException if the $document param is not an object * @return object The managed copy of the document. */ public function merge($document) { if (!is_object($document)) { throw new \InvalidArgumentException(gettype($document)); } $this->errorIfClosed(); return $this->unitOfWork->merge($document); }