Doctrine\ODM\MongoDB\DocumentManager::remove PHP Method

remove() public method

A removed document will be removed from the database at or before transaction commit or as a result of the flush operation.
public remove ( object $document )
$document object The document instance to remove.
    public function remove($document)
    {
        if (!is_object($document)) {
            throw new \InvalidArgumentException(gettype($document));
        }
        $this->errorIfClosed();
        $this->unitOfWork->remove($document);
    }

Usage Example

Example #1
0
 /**
  * @param Item        $item
  * @param string|null $collection
  * @return Item
  */
 public function delete($item, $collection = null)
 {
     $this->setCollection($collection);
     $this->dm->remove($item);
     $this->dm->flush();
     return $item;
 }
All Usage Examples Of Doctrine\ODM\MongoDB\DocumentManager::remove