detach() public method

Detaches an entity from the persistence management. It's persistence will no longer be managed by Doctrine.
public detach ( object $entity )
$entity object The entity to detach.
Example #1
0
 /**
  * Detaches an entity from the EntityManager, causing a managed entity to
  * become detached.  Unflushed changes made to the entity if any
  * (including removal of the entity), will not be synchronized to the database.
  * Entities which previously referenced the detached entity will continue to
  * reference it.
  *
  * @param object $entity The entity to detach.
  */
 public function detach($entity)
 {
     if (!is_object($entity)) {
         throw new \InvalidArgumentException(gettype($entity));
     }
     $this->unitOfWork->detach($entity);
 }
 /**
  * Detaches an entity from the EntityManager, causing a managed entity to
  * become detached.  Unflushed changes made to the entity if any
  * (including removal of the entity), will not be synchronized to the database.
  * Entities which previously referenced the detached entity will continue to
  * reference it.
  *
  * @param object $entity The entity to detach.
  */
 public function detach($entity)
 {
     if (!is_object($entity)) {
         throw ORMInvalidArgumentException::invalidObject('EntityManager#detach()', $entity);
     }
     $this->unitOfWork->detach($entity);
 }