Code Duplication    Length = 4-5 lines in 3 locations

lib/Doctrine/ORM/UnitOfWork.php 1 location

@@ 1989-1993 (lines=5) @@
1986
        $value   = $prevClass->reflFields[$assocField]->getValue($previousManagedCopy);
1987
        $value[] = $managedCopy;
1988
1989
        if ($association['type'] == ClassMetadata::ONE_TO_MANY) {
1990
            $class = $this->em->getClassMetadata(get_class($entity));
1991
1992
            $class->reflFields[$association['mappedBy']]->setValue($managedCopy, $previousManagedCopy);
1993
        }
1994
    }
1995
1996
    /**

lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 2 locations

@@ 486-489 (lines=4) @@
483
                                // If there is an inverse mapping on the target class its bidirectional
484
                                if ($relation['inversedBy']) {
485
                                    $inverseAssoc = $targetClass->associationMappings[$relation['inversedBy']];
486
                                    if ($inverseAssoc['type'] & ClassMetadata::TO_ONE) {
487
                                        $targetClass->reflFields[$inverseAssoc['fieldName']]->setValue($element, $parentObject);
488
                                        $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $inverseAssoc['fieldName'], $parentObject);
489
                                    }
490
                                } else if ($parentClass === $targetClass && $relation['mappedBy']) {
491
                                    // Special case: bi-directional self-referencing one-one on the same class
492
                                    $targetClass->reflFields[$relationField]->setValue($element, $parentObject);
@@ 494-498 (lines=5) @@
491
                                    // Special case: bi-directional self-referencing one-one on the same class
492
                                    $targetClass->reflFields[$relationField]->setValue($element, $parentObject);
493
                                }
494
                            } else {
495
                                // For sure bidirectional, as there is no inverse side in unidirectional mappings
496
                                $targetClass->reflFields[$relation['mappedBy']]->setValue($element, $parentObject);
497
                                $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $relation['mappedBy'], $parentObject);
498
                            }
499
                            // Update result pointer
500
                            $this->resultPointers[$dqlAlias] = $element;
501
                        } else {