Code Duplication    Length = 5-7 lines in 2 locations

lib/Doctrine/ODM/MongoDB/Persisters/PersistenceBuilder.php 2 locations

@@ 205-209 (lines=5) @@
202
203
            // @ReferenceOne
204
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
205
                if (isset($new) || $mapping['nullable'] === true) {
206
                    $updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
207
                } else {
208
                    $updateData['$unset'][$mapping['name']] = true;
209
                }
210
            }
211
        }
212
        // collections that aren't dirty but could be subject to update are
@@ 275-281 (lines=7) @@
272
                }
273
274
            // @ReferenceOne
275
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
276
                if (isset($new) || $mapping['nullable'] === true) {
277
                    $updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
278
                }
279
280
            // @ReferenceMany, @EmbedMany
281
            } elseif ($mapping['type'] === ClassMetadata::MANY && ! $mapping['isInverseSide']
282
                    && $new instanceof PersistentCollectionInterface && $new->isDirty()
283
                    && CollectionHelper::isAtomic($mapping['strategy'])) {
284
                $updateData['$set'][$mapping['name']] = $this->prepareAssociatedCollectionValue($new, true);