Code Duplication    Length = 8-9 lines in 2 locations

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

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