Doctrine\ODM\MongoDB\UnitOfWork::merge PHP Method

merge() public method

Merges the state of the given detached document into this UnitOfWork.
public merge ( object $document ) : object
$document object
return object The managed copy of the document.
    public function merge($document)
    {
        $visited = array();
        return $this->doMerge($document, $visited);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * 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.
  * @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);
 }
UnitOfWork