Doctrine\ODM\PHPCR\UnitOfWork::detach PHP Method

detach() public method

Detaches a document from the persistence management. It's persistence will no longer be managed by Doctrine.
public detach ( object $document )
$document object The document to detach.
    public function detach($document)
    {
        $visited = array();
        $this->doDetach($document, $visited);
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritDoc}
  *
  * Detaches an object from the ObjectManager
  *
  * If there are any not yet flushed changes on this object (including
  * removal of the object) will not be synchronized to the database.
  * Objects which previously referenced the detached object will continue to
  * reference it.
  *
  * @param object $document The object to detach.
  *
  * @throws InvalidArgumentException if $document is not an object.
  */
 public function detach($document)
 {
     if (!is_object($document)) {
         throw new InvalidArgumentException('Parameter $document needs to be an object, ' . gettype($document) . ' given');
     }
     $this->errorIfClosed();
     $this->unitOfWork->detach($document);
 }
UnitOfWork