Code Duplication    Length = 19-19 lines in 2 locations

src/Eccube/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php 1 location

@@ 106-124 (lines=19) @@
103
104
        // For every identifier, find out the SQL alias by combing through the ResultSetMapping
105
        $sqlIdentifier = array();
106
        foreach ($rootIdentifier as $property) {
107
            if (isset($rootClass->fieldMappings[$property])) {
108
                foreach (array_keys($this->rsm->fieldMappings, $property) as $alias) {
109
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
110
                        $sqlIdentifier[$property] = $alias;
111
                    }
112
                }
113
            }
114
115
            if (isset($rootClass->associationMappings[$property])) {
116
                $joinColumn = $rootClass->associationMappings[$property]['joinColumns'][0]['name'];
117
118
                foreach (array_keys($this->rsm->metaMappings, $joinColumn) as $alias) {
119
                    if ($this->rsm->columnOwnerMap[$alias] == $rootAlias) {
120
                        $sqlIdentifier[$property] = $alias;
121
                    }
122
                }
123
            }
124
        }
125
126
        if (count($rootIdentifier) != count($sqlIdentifier)) {
127
            throw new \RuntimeException(sprintf(

src/Eccube/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php 1 location

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