Beispiel #1
0
 /**
  * Removes document from mongo
  *
  * @param mixed $document
  * @param array $options 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->isLockable) {
         $query[$this->class->lockField] = 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);
     }
 }
 /**
  * Removes document from mongo
  *
  * @param mixed $document
  */
 public function delete($document)
 {
     $id = $this->_uow->getDocumentIdentifier($document);
     $this->_collection->remove(array('_id' => $this->_class->getDatabaseIdentifierValue($id)));
 }
 /**
  * Removes document from mongo
  *
  * @param mixed $document
  * @param array $options Array of options to be used with remove()
  */
 public function delete($document, array $options = array())
 {
     $id = $this->uow->getDocumentIdentifier($document);
     $this->collection->remove(array('_id' => $this->class->getDatabaseIdentifierValue($id)), $options);
 }
 public function delete($document)
 {
     $id = $this->_uow->getDocumentIdentifier($document);
     $this->_collection->remove(array('_id' => new \MongoId($id)));
 }