Code Duplication    Length = 5-7 lines in 2 locations

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

@@ 189-193 (lines=5) @@
186
187
            // @ReferenceOne
188
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
189
                if (isset($new) || $mapping['nullable'] === true) {
190
                    $updateData['$set'][$mapping['name']] = $new === null ? null : $this->prepareReferencedDocumentValue($mapping, $new);
191
                } else {
192
                    $updateData['$unset'][$mapping['name']] = true;
193
                }
194
            }
195
        }
196
        // collections that aren't dirty but could be subject to update are
@@ 261-267 (lines=7) @@
258
                }
259
260
            // @ReferenceOne
261
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
262
                if (isset($new) || $mapping['nullable'] === true) {
263
                    $updateData['$set'][$mapping['name']] = $new === null ? null : $this->prepareReferencedDocumentValue($mapping, $new);
264
                }
265
266
            // @ReferenceMany, @EmbedMany
267
            } elseif ($mapping['type'] === ClassMetadata::MANY && ! $mapping['isInverseSide']
268
                    && $new instanceof PersistentCollectionInterface && $new->isDirty()
269
                    && CollectionHelper::isAtomic($mapping['strategy'])) {
270
                $updateData['$set'][$mapping['name']] = $this->prepareAssociatedCollectionValue($new, true);