Doctrine\ODM\MongoDB\SchemaManager::dropDocumentCollection PHP Method

dropDocumentCollection() public method

Drop the document collection for a mapped class.
public dropDocumentCollection ( string $documentName )
$documentName string
    public function dropDocumentCollection($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes, embedded documents or query result documents.');
        }
        $this->dm->getDocumentCollection($documentName)->drop();
    }

Usage Example

Esempio n. 1
0
 protected function processDocumentCollection(SchemaManager $sm, $document)
 {
     $sm->dropDocumentCollection($document);
 }