Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 526-544 (lines=19) @@
523
524
        // For every identifier, find out the SQL alias by combing through the ResultSetMapping
525
        $sqlIdentifier = [];
526
        foreach ($rootIdentifier as $property) {
527
            if (isset($rootClass->fieldMappings[$property])) {
528
                foreach (array_keys($this->rsm->fieldMappings, $property) as $alias) {
529
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
530
                        $sqlIdentifier[$property] = $alias;
531
                    }
532
                }
533
            }
534
535
            if (isset($rootClass->associationMappings[$property])) {
536
                $joinColumn = $rootClass->associationMappings[$property]['joinColumns'][0]['name'];
537
538
                foreach (array_keys($this->rsm->metaMappings, $joinColumn) as $alias) {
539
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
540
                        $sqlIdentifier[$property] = $alias;
541
                    }
542
                }
543
            }
544
        }
545
546
        if (count($sqlIdentifier) === 0) {
547
            throw new \RuntimeException('The Paginator does not support Queries which only yield ScalarResults.');

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(