Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 42-50 (lines=9) @@
39
     *
40
     * @param int $timeout Timeout (ms) for acknowledged index creation
41
     */
42
    public function ensureIndexes($timeout = null)
43
    {
44
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
45
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
46
                continue;
47
            }
48
            $this->ensureDocumentIndexes($class->name, $timeout);
49
        }
50
    }
51
52
    /**
53
     * Ensure indexes exist for all mapped document classes.
@@ 60-68 (lines=9) @@
57
     *
58
     * @param int $timeout Timeout (ms) for acknowledged index creation
59
     */
60
    public function updateIndexes($timeout = null)
61
    {
62
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
63
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
64
                continue;
65
            }
66
            $this->updateDocumentIndexes($class->name, $timeout);
67
        }
68
    }
69
70
    /**
71
     * 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.