Code Duplication    Length = 5-7 lines in 2 locations

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

@@ 211-215 (lines=5) @@
208
209
            // @ReferenceOne
210
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
211
                if (isset($new) || $mapping['nullable'] === true) {
212
                    $updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
213
                } else {
214
                    $updateData['$unset'][$mapping['name']] = true;
215
                }
216
            }
217
        }
218
        // collections that aren't dirty but could be subject to update are
@@ 284-290 (lines=7) @@
281
                }
282
283
            // @ReferenceOne
284
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {
285
                if (isset($new) || $mapping['nullable'] === true) {
286
                    $updateData['$set'][$mapping['name']] = (is_null($new) ? null : $this->prepareReferencedDocumentValue($mapping, $new));
287
                }
288
289
            // @ReferenceMany, @EmbedMany
290
            } elseif ($mapping['type'] === ClassMetadata::MANY && ! $mapping['isInverseSide']
291
                    && $new instanceof PersistentCollection && $new->isDirty()
292
                    && CollectionHelper::isAtomic($mapping['strategy'])) {
293
                $updateData['$set'][$mapping['name']] = $this->prepareAssociatedCollectionValue($new, true);