Code Duplication    Length = 9-9 lines in 7 locations

lib/Doctrine/ODM/MongoDB/SchemaManager.php 7 locations

@@ 55-63 (lines=9) @@
52
     *
53
     * @param integer $timeout Timeout (ms) for acknowledged index creation
54
     */
55
    public function ensureIndexes($timeout = null)
56
    {
57
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
58
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
59
                continue;
60
            }
61
            $this->ensureDocumentIndexes($class->name, $timeout);
62
        }
63
    }
64
65
    /**
66
     * Ensure indexes exist for all mapped document classes.
@@ 73-81 (lines=9) @@
70
     *
71
     * @param integer $timeout Timeout (ms) for acknowledged index creation
72
     */
73
    public function updateIndexes($timeout = null)
74
    {
75
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
76
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
77
                continue;
78
            }
79
            $this->updateDocumentIndexes($class->name, $timeout);
80
        }
81
    }
82
83
    /**
84
     * Ensure indexes exist for the mapped document class.
@@ 281-289 (lines=9) @@
278
     * Delete indexes for all documents that can be loaded with the
279
     * metadata factory.
280
     */
281
    public function deleteIndexes()
282
    {
283
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
284
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
285
                continue;
286
            }
287
            $this->deleteDocumentIndexes($class->name);
288
        }
289
    }
290
291
    /**
292
     * Delete the given document's indexes.
@@ 309-317 (lines=9) @@
306
    /**
307
     * Create all the mapped document collections in the metadata factory.
308
     */
309
    public function createCollections()
310
    {
311
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
312
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
313
                continue;
314
            }
315
            $this->createDocumentCollection($class->name);
316
        }
317
    }
318
319
    /**
320
     * Create the document collection for a mapped class.
@@ 351-359 (lines=9) @@
348
    /**
349
     * Drop all the mapped document collections in the metadata factory.
350
     */
351
    public function dropCollections()
352
    {
353
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
354
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
355
                continue;
356
            }
357
            $this->dropDocumentCollection($class->name);
358
        }
359
    }
360
361
    /**
362
     * Drop the document collection for a mapped class.
@@ 409-417 (lines=9) @@
406
     *
407
     * @deprecated Databases are created automatically by MongoDB (>= 3.0). Deprecated since ODM 1.2, to be removed in ODM 2.0.
408
     */
409
    public function createDatabases()
410
    {
411
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
412
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
413
                continue;
414
            }
415
            $this->createDocumentDatabase($class->name);
416
        }
417
    }
418
419
    /**
420
     * Create the document database for a mapped class.
@@ 379-387 (lines=9) @@
376
    /**
377
     * Drop all the mapped document databases in the metadata factory.
378
     */
379
    public function dropDatabases()
380
    {
381
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
382
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
383
                continue;
384
            }
385
            $this->dropDocumentDatabase($class->name);
386
        }
387
    }
388
389
    /**
390
     * Drop the document database for a mapped class.