Code Duplication    Length = 9-9 lines in 3 locations

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php 1 location

@@ 377-385 (lines=9) @@
374
            $mapping = $this->targetClass->getFieldMapping($mapping['mappedBy']);
375
        }
376
377
        switch ($mapping['storeAs']) {
378
            case ClassMetadataInfo::REFERENCE_STORE_AS_ID:
379
            case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
380
                return ClassMetadataInfo::getReferenceFieldName($mapping['storeAs'], $mapping['name']);
381
                break;
382
383
            default:
384
                throw MappingException::cannotLookupDbRefReference($this->class->name, $fieldName);
385
        }
386
    }
387
}
388

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php 2 locations

@@ 220-228 (lines=9) @@
217
        $this->from = $this->targetClass->getCollection();
218
219
        if ($referenceMapping['isOwningSide']) {
220
            switch ($referenceMapping['storeAs']) {
221
                case ClassMetadataInfo::REFERENCE_STORE_AS_ID:
222
                case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
223
                    $referencedFieldName = ClassMetadataInfo::getReferenceFieldName($referenceMapping['storeAs'], $referenceMapping['name']);
224
                    break;
225
226
                default:
227
                    throw MappingException::cannotLookupDbRefReference($this->class->name, $fieldName);
228
            }
229
230
            $this
231
                ->foreignField('_id')
@@ 239-247 (lines=9) @@
236
            }
237
238
            $mappedByMapping = $this->targetClass->getFieldMapping($referenceMapping['mappedBy']);
239
            switch ($mappedByMapping['storeAs']) {
240
                case ClassMetadataInfo::REFERENCE_STORE_AS_ID:
241
                case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
242
                    $referencedFieldName = ClassMetadataInfo::getReferenceFieldName($mappedByMapping['storeAs'], $mappedByMapping['name']);
243
                    break;
244
245
                default:
246
                    throw MappingException::cannotLookupDbRefReference($this->class->name, $fieldName);
247
            }
248
249
            $this
250
                ->localField('_id')