Code Duplication    Length = 5-7 lines in 2 locations

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

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