Doctrine\ODM\MongoDB\Persisters\DocumentPersister::delete PHP Метод

delete() публичный Метод

Removes document from mongo
public delete ( mixed $document, array $options = [] )
$document mixed
$options array Array of options to be used with remove()
    public function delete($document, array $options = array())
    {
        $id = $this->uow->getDocumentIdentifier($document);
        $query = array('_id' => $this->class->getDatabaseIdentifierValue($id));

        if ($this->class->isVersioned) {
            $query['locked'] = array($this->cmd . 'exists' => false);
            $options['safe'] = true;
        }

        $result = $this->collection->remove($query, $options);

        if (($this->class->isVersioned || $this->class->isLockable)  && ! $result['n']) {
            throw LockException::lockFailed($document);
        }
    }