Code Duplication    Length = 18-18 lines in 2 locations

lib/Doctrine/ODM/MongoDB/DocumentManager.php 1 location

@@ 724-741 (lines=18) @@
721
        /* Add a discriminator value if the referenced document is not mapped
722
         * explicitly to a targetDocument class.
723
         */
724
        if (! isset($referenceMapping['targetDocument'])) {
725
            $discriminatorField = $referenceMapping['discriminatorField'];
726
            $discriminatorValue = isset($referenceMapping['discriminatorMap'])
727
                ? array_search($class->name, $referenceMapping['discriminatorMap'])
728
                : $class->name;
729
730
            /* If the discriminator value was not found in the map, use the full
731
             * class name. In the future, it may be preferable to throw an
732
             * exception here (perhaps based on some strictness option).
733
             *
734
             * @see PersistenceBuilder::prepareEmbeddedDocumentValue()
735
             */
736
            if ($discriminatorValue === false) {
737
                $discriminatorValue = $class->name;
738
            }
739
740
            $reference[$discriminatorField] = $discriminatorValue;
741
        }
742
743
        return $reference;
744
    }

lib/Doctrine/ODM/MongoDB/Persisters/PersistenceBuilder.php 1 location

@@ 373-390 (lines=18) @@
370
        /* Add a discriminator value if the embedded document is not mapped
371
         * explicitly to a targetDocument class.
372
         */
373
        if ( ! isset($embeddedMapping['targetDocument'])) {
374
            $discriminatorField = $embeddedMapping['discriminatorField'];
375
            $discriminatorValue = isset($embeddedMapping['discriminatorMap'])
376
                ? array_search($class->name, $embeddedMapping['discriminatorMap'])
377
                : $class->name;
378
379
            /* If the discriminator value was not found in the map, use the full
380
             * class name. In the future, it may be preferable to throw an
381
             * exception here (perhaps based on some strictness option).
382
             *
383
             * @see DocumentManager::createDBRef()
384
             */
385
            if ($discriminatorValue === false) {
386
                $discriminatorValue = $class->name;
387
            }
388
389
            $embeddedDocumentValue[$discriminatorField] = $discriminatorValue;
390
        }
391
392
        /* If the class has a discriminator (field and value), use it. A child
393
         * class that is not defined in the discriminator map may only have a