Code Duplication    Length = 8-9 lines in 2 locations

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

@@ 152-159 (lines=8) @@
149
                    $updateData['$unset'][$mapping['name']] = true;
150
151
                // Update existing embedded document
152
                } else {
153
                    $update = $this->prepareUpdateData($new);
154
                    foreach ($update as $cmd => $values) {
155
                        foreach ($values as $key => $value) {
156
                            $updateData[$cmd][$mapping['name'] . '.' . $key] = $value;
157
                        }
158
                    }
159
                }
160
161
            // @ReferenceMany, @EmbedMany
162
            } elseif (isset($mapping['association']) && $mapping['type'] === 'many' && $new) {
@@ 245-253 (lines=9) @@
242
                // If we have a new embedded document then lets set the whole thing
243
                if ($new && $this->uow->isScheduledForInsert($new)) {
244
                    $updateData['$set'][$mapping['name']] = $this->prepareEmbeddedDocumentValue($mapping, $new);
245
                } elseif ($new) {
246
                    // Update existing embedded document
247
                    $update = $this->prepareUpsertData($new);
248
                    foreach ($update as $cmd => $values) {
249
                        foreach ($values as $key => $value) {
250
                            $updateData[$cmd][$mapping['name'] . '.' . $key] = $value;
251
                        }
252
                    }
253
                }
254
255
            // @ReferenceOne
256
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {