Code Duplication    Length = 11-11 lines in 3 locations

src/ORM/DataQuery.php 3 locations

@@ 930-940 (lines=11) @@
927
        // its ancestor fields.
928
        $ancestry = ClassInfo::ancestry($foreignClass, true);
929
        $ancestry = array_reverse($ancestry);
930
        foreach ($ancestry as $ancestor) {
931
            $ancestorTable = $schema->tableName($ancestor);
932
            if ($ancestorTable !== $foreignTable) {
933
                $ancestorTableAliased = $foreignPrefix.$ancestorTable;
934
                $this->query->addLeftJoin(
935
                    $ancestorTable,
936
                    "\"{$foreignTableAliased}\".\"ID\" = \"{$ancestorTableAliased}\".\"ID\"",
937
                    $ancestorTableAliased
938
                );
939
            }
940
        }
941
    }
942
943
    /**
@@ 991-1001 (lines=11) @@
988
        $ancestry = ClassInfo::ancestry($foreignClass, true);
989
        if (!empty($ancestry)) {
990
            $ancestry = array_reverse($ancestry);
991
            foreach ($ancestry as $ancestor) {
992
                $ancestorTable = $schema->tableName($ancestor);
993
                if ($ancestorTable !== $foreignBaseTable) {
994
                    $ancestorTableAliased = $foreignPrefix.$ancestorTable;
995
                    $this->query->addLeftJoin(
996
                        $ancestorTable,
997
                        "{$foreignIDColumn} = \"{$ancestorTableAliased}\".\"ID\"",
998
                        $ancestorTableAliased
999
                    );
1000
                }
1001
            }
1002
        }
1003
    }
1004
@@ 1062-1072 (lines=11) @@
1059
        // its ancestor fields.
1060
        $ancestry = ClassInfo::ancestry($componentClass, true);
1061
        $ancestry = array_reverse($ancestry);
1062
        foreach ($ancestry as $ancestor) {
1063
            $ancestorTable = $schema->tableName($ancestor);
1064
            if ($ancestorTable !== $componentBaseTable) {
1065
                $ancestorTableAliased = $componentPrefix.$ancestorTable;
1066
                $this->query->addLeftJoin(
1067
                    $ancestorTable,
1068
                    "{$componentIDColumn} = \"{$ancestorTableAliased}\".\"ID\"",
1069
                    $ancestorTableAliased
1070
                );
1071
            }
1072
        }
1073
    }
1074
1075
    /**