@@ 294-301 (lines=8) @@ | ||
291 | * @param string $documentName |
|
292 | * @throws \InvalidArgumentException |
|
293 | */ |
|
294 | public function deleteDocumentIndexes($documentName) |
|
295 | { |
|
296 | $class = $this->dm->getClassMetadata($documentName); |
|
297 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
298 | throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.'); |
|
299 | } |
|
300 | $this->dm->getDocumentCollection($documentName)->deleteIndexes(); |
|
301 | } |
|
302 | ||
303 | /** |
|
304 | * Create all the mapped document collections in the metadata factory. |
|
@@ 364-373 (lines=10) @@ | ||
361 | * @param string $documentName |
|
362 | * @throws \InvalidArgumentException |
|
363 | */ |
|
364 | public function dropDocumentCollection($documentName) |
|
365 | { |
|
366 | $class = $this->dm->getClassMetadata($documentName); |
|
367 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
368 | throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.'); |
|
369 | } |
|
370 | $this->dm->getDocumentDatabase($documentName)->dropCollection( |
|
371 | $class->getCollection() |
|
372 | ); |
|
373 | } |
|
374 | ||
375 | /** |
|
376 | * Drop all the mapped document databases in the metadata factory. |
|
@@ 394-401 (lines=8) @@ | ||
391 | * @param string $documentName |
|
392 | * @throws \InvalidArgumentException |
|
393 | */ |
|
394 | public function dropDocumentDatabase($documentName) |
|
395 | { |
|
396 | $class = $this->dm->getClassMetadata($documentName); |
|
397 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
398 | throw new \InvalidArgumentException('Cannot drop document database for mapped super classes or embedded documents.'); |
|
399 | } |
|
400 | $this->dm->getDocumentDatabase($documentName)->drop(); |
|
401 | } |
|
402 | ||
403 | /** |
|
404 | * Create all the mapped document databases in the metadata factory. |
|
@@ 422-429 (lines=8) @@ | ||
419 | * @param string $documentName |
|
420 | * @throws \InvalidArgumentException |
|
421 | */ |
|
422 | public function createDocumentDatabase($documentName) |
|
423 | { |
|
424 | $class = $this->dm->getClassMetadata($documentName); |
|
425 | if ($class->isMappedSuperclass || $class->isEmbeddedDocument) { |
|
426 | throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.'); |
|
427 | } |
|
428 | $this->dm->getDocumentDatabase($documentName)->execute("function() { return true; }"); |
|
429 | } |
|
430 | ||
431 | /** |
|
432 | * Determine if an index returned by MongoCollection::getIndexInfo() can be |