Code Duplication    Length = 5-7 lines in 2 locations

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

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