Code Duplication    Length = 9-9 lines in 3 locations

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

@@ 200-208 (lines=9) @@
197
            $mapping = $this->targetClass->getFieldMapping($mapping['mappedBy']);
198
        }
199
200
        switch ($mapping['storeAs']) {
201
            case ClassMetadataInfo::REFERENCE_STORE_AS_ID:
202
            case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
203
                return ClassMetadataInfo::getReferenceFieldName($mapping['storeAs'], $mapping['name']);
204
                break;
205
206
            default:
207
                throw MappingException::cannotLookupDbRefReference($this->class->name, $fieldName);
208
        }
209
    }
210
}
211

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

@@ 113-121 (lines=9) @@
110
        parent::from($this->targetClass->getCollection());
111
112
        if ($referenceMapping['isOwningSide']) {
113
            switch ($referenceMapping['storeAs']) {
114
                case ClassMetadataInfo::REFERENCE_STORE_AS_ID:
115
                case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
116
                    $referencedFieldName = ClassMetadataInfo::getReferenceFieldName($referenceMapping['storeAs'], $referenceMapping['name']);
117
                    break;
118
119
                default:
120
                   throw MappingException::cannotLookupDbRefReference($this->class->name, $fieldName);
121
            }
122
123
            $this
124
                ->foreignField('_id')
@@ 132-140 (lines=9) @@
129
            }
130
131
            $mappedByMapping = $this->targetClass->getFieldMapping($referenceMapping['mappedBy']);
132
            switch ($mappedByMapping['storeAs']) {
133
                case ClassMetadataInfo::REFERENCE_STORE_AS_ID:
134
                case ClassMetadataInfo::REFERENCE_STORE_AS_REF:
135
                    $referencedFieldName = ClassMetadataInfo::getReferenceFieldName($mappedByMapping['storeAs'], $mappedByMapping['name']);
136
                    break;
137
138
                default:
139
                    throw MappingException::cannotLookupDbRefReference($this->class->name, $fieldName);
140
            }
141
142
            $this
143
                ->localField('_id')