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

@@ 524-527 (lines=4) @@
521
                                // If there is an inverse mapping on the target class its bidirectional
522
                                if ($relation['inversedBy']) {
523
                                    $inverseAssoc = $targetClass->associationMappings[$relation['inversedBy']];
524
                                    if ($inverseAssoc['type'] & ClassMetadata::TO_ONE) {
525
                                        $targetClass->reflFields[$inverseAssoc['fieldName']]->setValue($element, $parentObject);
526
                                        $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $inverseAssoc['fieldName'], $parentObject);
527
                                    }
528
                                } else if ($parentClass === $targetClass && $relation['mappedBy']) {
529
                                    // Special case: bi-directional self-referencing one-one on the same class
530
                                    $targetClass->reflFields[$relationField]->setValue($element, $parentObject);
@@ 532-536 (lines=5) @@
529
                                    // Special case: bi-directional self-referencing one-one on the same class
530
                                    $targetClass->reflFields[$relationField]->setValue($element, $parentObject);
531
                                }
532
                            } else {
533
                                // For sure bidirectional, as there is no inverse side in unidirectional mappings
534
                                $targetClass->reflFields[$relation['mappedBy']]->setValue($element, $parentObject);
535
                                $this->_uow->setOriginalEntityProperty(spl_object_hash($element), $relation['mappedBy'], $parentObject);
536
                            }
537
                            // Update result pointer
538
                            $this->resultPointers[$dqlAlias] = $element;
539
                        } else {