Code Duplication    Length = 8-9 lines in 2 locations

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

@@ 171-178 (lines=8) @@
168
                    $updateData['$unset'][$mapping['name']] = true;
169
170
                // Update existing embedded document
171
                } else {
172
                    $update = $this->prepareUpdateData($new);
173
                    foreach ($update as $cmd => $values) {
174
                        foreach ($values as $key => $value) {
175
                            $updateData[$cmd][$mapping['name'] . '.' . $key] = $value;
176
                        }
177
                    }
178
                }
179
180
            // @ReferenceMany, @EmbedMany
181
            } elseif (isset($mapping['association']) && $mapping['type'] === 'many' && $new) {
@@ 264-272 (lines=9) @@
261
                // If we have a new embedded document then lets set the whole thing
262
                if ($new && $this->uow->isScheduledForInsert($new)) {
263
                    $updateData['$set'][$mapping['name']] = $this->prepareEmbeddedDocumentValue($mapping, $new);
264
                } elseif ($new) {
265
                    // Update existing embedded document
266
                    $update = $this->prepareUpsertData($new);
267
                    foreach ($update as $cmd => $values) {
268
                        foreach ($values as $key => $value) {
269
                            $updateData[$cmd][$mapping['name'] . '.' . $key] = $value;
270
                        }
271
                    }
272
                }
273
274
            // @ReferenceOne
275
            } elseif (isset($mapping['association']) && $mapping['association'] === ClassMetadata::REFERENCE_ONE) {