Code Duplication    Length = 19-19 lines in 2 locations

lib/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php 1 location

@@ 120-138 (lines=19) @@
117
118
        // For every identifier, find out the SQL alias by combing through the ResultSetMapping
119
        $sqlIdentifier = [];
120
        foreach ($rootIdentifier as $property) {
121
            if (isset($rootClass->fieldMappings[$property])) {
122
                foreach (array_keys($this->rsm->fieldMappings, $property) as $alias) {
123
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
124
                        $sqlIdentifier[$property] = $alias;
125
                    }
126
                }
127
            }
128
129
            if (isset($rootClass->associationMappings[$property])) {
130
                $joinColumn = $rootClass->associationMappings[$property]['joinColumns'][0]['name'];
131
132
                foreach (array_keys($this->rsm->metaMappings, $joinColumn) as $alias) {
133
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
134
                        $sqlIdentifier[$property] = $alias;
135
                    }
136
                }
137
            }
138
        }
139
140
        if (count($rootIdentifier) != count($sqlIdentifier)) {
141
            throw new \RuntimeException(sprintf(

lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php 1 location

@@ 542-560 (lines=19) @@
539
540
        // For every identifier, find out the SQL alias by combing through the ResultSetMapping
541
        $sqlIdentifier = [];
542
        foreach ($rootIdentifier as $property) {
543
            if (isset($rootClass->fieldMappings[$property])) {
544
                foreach (array_keys($this->rsm->fieldMappings, $property) as $alias) {
545
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
546
                        $sqlIdentifier[$property] = $alias;
547
                    }
548
                }
549
            }
550
551
            if (isset($rootClass->associationMappings[$property])) {
552
                $joinColumn = $rootClass->associationMappings[$property]['joinColumns'][0]['name'];
553
554
                foreach (array_keys($this->rsm->metaMappings, $joinColumn) as $alias) {
555
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
556
                        $sqlIdentifier[$property] = $alias;
557
                    }
558
                }
559
            }
560
        }
561
562
        if (count($sqlIdentifier) === 0) {
563
            throw new \RuntimeException('The Paginator does not support Queries which only yield ScalarResults.');