doctrine/orm · error · LogicException

No result variable found for string expression "%s".

Error message

No result variable found for string expression "%s".

What it means

Error "No result variable found for string expression "%s"." thrown in doctrine/orm.

Source

Thrown at src/Query/SqlWalker.php:2126

        if ($betweenExpr->not) {
            $sql .= ' NOT';
        }

        $sql .= ' BETWEEN ' . $this->walkArithmeticExpression($betweenExpr->leftBetweenExpression)
            . ' AND ' . $this->walkArithmeticExpression($betweenExpr->rightBetweenExpression);

        return $sql;
    }

    /**
     * Walks down a LikeExpression AST node, thereby generating the appropriate SQL.
     */
    public function walkLikeExpression(AST\LikeExpression $likeExpr): string
    {
        $stringExpr = $likeExpr->stringExpression;
        if (is_string($stringExpr)) {
            if (! isset($this->queryComponents[$stringExpr]['resultVariable'])) {
                throw new LogicException(sprintf('No result variable found for string expression "%s".', $stringExpr));
            }

            $leftExpr = $this->walkResultVariable($stringExpr);
        } else {
            $leftExpr = $stringExpr->dispatch($this);
        }

        $sql = $leftExpr . ($likeExpr->not ? ' NOT' : '') . ' LIKE ';

        if ($likeExpr->stringPattern instanceof AST\InputParameter) {
            $sql .= $this->walkInputParameter($likeExpr->stringPattern);
        } elseif ($likeExpr->stringPattern instanceof AST\Functions\FunctionNode) {
            $sql .= $this->walkFunction($likeExpr->stringPattern);
        } elseif ($likeExpr->stringPattern instanceof AST\PathExpression) {
            $sql .= $this->walkPathExpression($likeExpr->stringPattern);
        } else {
            $sql .= $this->walkLiteral($likeExpr->stringPattern);
        }

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Query/SqlWalker.php:2126 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/26fa55618c0f0d48. Report an issue: GitHub.