Code Duplication    Length = 5-7 lines in 2 locations

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

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