Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 36-44 (lines=9) @@
33
     *
34
     * @param int $timeout Timeout (ms) for acknowledged index creation
35
     */
36
    public function ensureIndexes($timeout = null)
37
    {
38
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
39
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
40
                continue;
41
            }
42
            $this->ensureDocumentIndexes($class->name, $timeout);
43
        }
44
    }
45
46
    /**
47
     * Ensure indexes exist for all mapped document classes.
@@ 54-62 (lines=9) @@
51
     *
52
     * @param int $timeout Timeout (ms) for acknowledged index creation
53
     */
54
    public function updateIndexes($timeout = null)
55
    {
56
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
57
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
58
                continue;
59
            }
60
            $this->updateDocumentIndexes($class->name, $timeout);
61
        }
62
    }
63
64
    /**
65
     * Ensure indexes exist for the mapped document class.
@@ 248-256 (lines=9) @@
245
     * Delete indexes for all documents that can be loaded with the
246
     * metadata factory.
247
     */
248
    public function deleteIndexes()
249
    {
250
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
251
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
252
                continue;
253
            }
254
            $this->deleteDocumentIndexes($class->name);
255
        }
256
    }
257
258
    /**
259
     * Delete the given document's indexes.
@@ 276-284 (lines=9) @@
273
    /**
274
     * Create all the mapped document collections in the metadata factory.
275
     */
276
    public function createCollections()
277
    {
278
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
279
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
280
                continue;
281
            }
282
            $this->createDocumentCollection($class->name);
283
        }
284
    }
285
286
    /**
287
     * Create the document collection for a mapped class.
@@ 313-321 (lines=9) @@
310
    /**
311
     * Drop all the mapped document collections in the metadata factory.
312
     */
313
    public function dropCollections()
314
    {
315
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
316
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
317
                continue;
318
            }
319
            $this->dropDocumentCollection($class->name);
320
        }
321
    }
322
323
    /**
324
     * Drop the document collection for a mapped class.
@@ 341-349 (lines=9) @@
338
    /**
339
     * Drop all the mapped document databases in the metadata factory.
340
     */
341
    public function dropDatabases()
342
    {
343
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
344
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
345
                continue;
346
            }
347
            $this->dropDocumentDatabase($class->name);
348
        }
349
    }
350
351
    /**
352
     * Drop the document database for a mapped class.