Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 41-49 (lines=9) @@
38
     *
39
     * @param integer $timeout Timeout (ms) for acknowledged index creation
40
     */
41
    public function ensureIndexes($timeout = null)
42
    {
43
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
44
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
45
                continue;
46
            }
47
            $this->ensureDocumentIndexes($class->name, $timeout);
48
        }
49
    }
50
51
    /**
52
     * Ensure indexes exist for all mapped document classes.
@@ 59-67 (lines=9) @@
56
     *
57
     * @param integer $timeout Timeout (ms) for acknowledged index creation
58
     */
59
    public function updateIndexes($timeout = null)
60
    {
61
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
62
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
63
                continue;
64
            }
65
            $this->updateDocumentIndexes($class->name, $timeout);
66
        }
67
    }
68
69
    /**
70
     * Ensure indexes exist for the mapped document class.
@@ 252-260 (lines=9) @@
249
     * Delete indexes for all documents that can be loaded with the
250
     * metadata factory.
251
     */
252
    public function deleteIndexes()
253
    {
254
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
255
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
256
                continue;
257
            }
258
            $this->deleteDocumentIndexes($class->name);
259
        }
260
    }
261
262
    /**
263
     * Delete the given document's indexes.
@@ 280-288 (lines=9) @@
277
    /**
278
     * Create all the mapped document collections in the metadata factory.
279
     */
280
    public function createCollections()
281
    {
282
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
283
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
284
                continue;
285
            }
286
            $this->createDocumentCollection($class->name);
287
        }
288
    }
289
290
    /**
291
     * Create the document collection for a mapped class.
@@ 317-325 (lines=9) @@
314
    /**
315
     * Drop all the mapped document collections in the metadata factory.
316
     */
317
    public function dropCollections()
318
    {
319
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
320
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
321
                continue;
322
            }
323
            $this->dropDocumentCollection($class->name);
324
        }
325
    }
326
327
    /**
328
     * Drop the document collection for a mapped class.
@@ 345-353 (lines=9) @@
342
    /**
343
     * Drop all the mapped document databases in the metadata factory.
344
     */
345
    public function dropDatabases()
346
    {
347
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
348
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
349
                continue;
350
            }
351
            $this->dropDocumentDatabase($class->name);
352
        }
353
    }
354
355
    /**
356
     * Drop the document database for a mapped class.