Code Duplication    Length = 8-9 lines in 2 locations

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

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