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

@@ 506-509 (lines=4) @@
503
                                // If there is an inverse mapping on the target class its bidirectional
504
                                if ($relation['inversedBy']) {
505
                                    $inverseAssoc = $targetClass->associationMappings[$relation['inversedBy']];
506
                                    if ($inverseAssoc['type'] & ClassMetadata::TO_ONE) {
507
                                        $targetClass->reflFields[$inverseAssoc['fieldName']]->setValue($element, $parentObject);
508
                                        $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $inverseAssoc['fieldName'], $parentObject);
509
                                    }
510
                                } else if ($parentClass === $targetClass && $relation['mappedBy']) {
511
                                    // Special case: bi-directional self-referencing one-one on the same class
512
                                    $targetClass->reflFields[$relationField]->setValue($element, $parentObject);
@@ 514-518 (lines=5) @@
511
                                    // Special case: bi-directional self-referencing one-one on the same class
512
                                    $targetClass->reflFields[$relationField]->setValue($element, $parentObject);
513
                                }
514
                            } else {
515
                                // For sure bidirectional, as there is no inverse side in unidirectional mappings
516
                                $targetClass->reflFields[$relation['mappedBy']]->setValue($element, $parentObject);
517
                                $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $relation['mappedBy'], $parentObject);
518
                            }
519
                            // Update result pointer
520
                            $this->resultPointers[$dqlAlias] = $element;
521
                        } else {