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

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