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

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