Sokil\Mongo\Collection::deleteDocument PHP Method

deleteDocument() public method

Deprecation: since 1.13. Use Document::delete()
public deleteDocument ( Document $document ) : Collection
$document Document
return Collection
    public function deleteDocument(Document $document)
    {
        $document->delete();
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * @expectedException \Sokil\Mongo\Exception
  * @expectedExceptionMessage Delete document error: Some strange error
  */
 public function testDeleteDocument_ErrorDeletingDocument()
 {
     $this->collectionMock = $this->getMock('\\MongoCollection', array('remove'), array($this->database->getMongoDB(), 'phpmongo_test_collection'));
     $this->collectionMock->expects($this->once())->method('remove')->will($this->returnValue(array('ok' => (double) 0, 'err' => 'Some strange error')));
     $this->collection = new Collection($this->database, $this->collectionMock);
     $document = $this->collection->createDocument(array('param' => 'value'))->save();
     $this->collection->deleteDocument($document);
 }
All Usage Examples Of Sokil\Mongo\Collection::deleteDocument