Code Duplication    Length = 10-11 lines in 2 locations

src/ORM/DataObject.php 2 locations

@@ 950-959 (lines=10) @@
947
948
        // merge relations
949
        if ($includeRelations) {
950
            if ($manyMany = $this->manyMany()) {
951
                foreach ($manyMany as $relationship => $class) {
952
                    $leftComponents = $leftObj->getManyManyComponents($relationship);
953
                    $rightComponents = $rightObj->getManyManyComponents($relationship);
954
                    if ($rightComponents && $rightComponents->exists()) {
955
                        $leftComponents->addMany($rightComponents->column('ID'));
956
                    }
957
                    $leftComponents->write();
958
                }
959
            }
960
961
            if ($hasMany = $this->hasMany()) {
962
                foreach ($hasMany as $relationship => $class) {
@@ 961-971 (lines=11) @@
958
                }
959
            }
960
961
            if ($hasMany = $this->hasMany()) {
962
                foreach ($hasMany as $relationship => $class) {
963
                    $leftComponents = $leftObj->getComponents($relationship);
964
                    $rightComponents = $rightObj->getComponents($relationship);
965
                    if ($rightComponents && $rightComponents->exists()) {
966
                        $leftComponents->addMany($rightComponents->column('ID'));
967
                    }
968
                    $leftComponents->write();
969
                }
970
            }
971
        }
972
973
        return true;
974
    }