@@ 300-307 (lines=8) @@ | ||
297 | * @param string $documentName |
|
298 | * @throws \InvalidArgumentException |
|
299 | */ |
|
300 | public function deleteDocumentIndexes($documentName) |
|
301 | { |
|
302 | $class = $this->dm->getClassMetadata($documentName); |
|
303 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
304 | throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.'); |
|
305 | } |
|
306 | $this->dm->getDocumentCollection($documentName)->deleteIndexes(); |
|
307 | } |
|
308 | ||
309 | /** |
|
310 | * Create all the mapped document collections in the metadata factory. |
|
@@ 370-379 (lines=10) @@ | ||
367 | * @param string $documentName |
|
368 | * @throws \InvalidArgumentException |
|
369 | */ |
|
370 | public function dropDocumentCollection($documentName) |
|
371 | { |
|
372 | $class = $this->dm->getClassMetadata($documentName); |
|
373 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
374 | throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.'); |
|
375 | } |
|
376 | $this->dm->getDocumentDatabase($documentName)->dropCollection( |
|
377 | $class->getCollection() |
|
378 | ); |
|
379 | } |
|
380 | ||
381 | /** |
|
382 | * Drop all the mapped document databases in the metadata factory. |
|
@@ 400-407 (lines=8) @@ | ||
397 | * @param string $documentName |
|
398 | * @throws \InvalidArgumentException |
|
399 | */ |
|
400 | public function dropDocumentDatabase($documentName) |
|
401 | { |
|
402 | $class = $this->dm->getClassMetadata($documentName); |
|
403 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
404 | throw new \InvalidArgumentException('Cannot drop document database for mapped super classes or embedded documents.'); |
|
405 | } |
|
406 | $this->dm->getDocumentDatabase($documentName)->drop(); |
|
407 | } |
|
408 | ||
409 | /** |
|
410 | * Create all the mapped document databases in the metadata factory. |
|
@@ 428-435 (lines=8) @@ | ||
425 | * @param string $documentName |
|
426 | * @throws \InvalidArgumentException |
|
427 | */ |
|
428 | public function createDocumentDatabase($documentName) |
|
429 | { |
|
430 | $class = $this->dm->getClassMetadata($documentName); |
|
431 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
432 | throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.'); |
|
433 | } |
|
434 | $this->dm->getDocumentDatabase($documentName)->execute("function() { return true; }"); |
|
435 | } |
|
436 | ||
437 | /** |
|
438 | * Determine if an index returned by MongoCollection::getIndexInfo() can be |