doctrine/orm · error · RuntimeException

The Paginator does not support Queries which only yield Scal

Error message

The Paginator does not support Queries which only yield ScalarResults.

What it means

Error "The Paginator does not support Queries which only yield ScalarResults." thrown in doctrine/orm.

Source

Thrown at src/Tools/Pagination/LimitSubqueryOutputWalker.php:550

                    }
                }
            }

            if (isset($rootClass->associationMappings[$property])) {
                $association = $rootClass->associationMappings[$property];
                assert($association->isToOneOwningSide());
                $joinColumn = $association->joinColumns[0]->name;

                foreach (array_keys($this->rsm->metaMappings, $joinColumn, true) as $alias) {
                    if ($this->rsm->columnOwnerMap[$alias] === $rootAlias) {
                        $sqlIdentifier[$property] = $alias;
                    }
                }
            }
        }

        if (count($sqlIdentifier) === 0) {
            throw new RuntimeException('The Paginator does not support Queries which only yield ScalarResults.');
        }

        if (count($rootIdentifier) !== count($sqlIdentifier)) {
            throw new RuntimeException(sprintf(
                'Not all identifier properties can be found in the ResultSetMapping: %s',
                implode(', ', array_diff($rootIdentifier, array_keys($sqlIdentifier))),
            ));
        }

        return $sqlIdentifier;
    }

    public function walkPathExpression(PathExpression $pathExpr): string
    {
        if (! $this->inSubSelect && ! $this->platformSupportsRowNumber() && ! in_array($pathExpr, $this->orderByPathExpressions, true)) {
            $this->orderByPathExpressions[] = $pathExpr;
        }

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Tools/Pagination/LimitSubqueryOutputWalker.php:550 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of doctrine/orm@d9b9ff7301 (2026-08-21). Data as JSON: /api/errors/6940e4f437a56054. Report an issue: GitHub.