doctrine/orm · error · LogicException

Option 'first-result' must contain an integer value

Error message

Option 'first-result' must contain an integer value

What it means

Error "Option 'first-result' must contain an integer value" thrown in doctrine/orm.

Source

Thrown at src/Tools/Console/Command/RunDqlCommand.php:91

            throw new LogicException("Option 'depth' must contain an integer value");
        }

        $hydrationModeName = (string) $input->getOption('hydrate');
        $hydrationMode     = 'Doctrine\ORM\Query::HYDRATE_' . strtoupper(str_replace('-', '_', $hydrationModeName));

        if (! defined($hydrationMode)) {
            throw new RuntimeException(sprintf(
                "Hydration mode '%s' does not exist. It should be either: object. array, scalar or single-scalar.",
                $hydrationModeName,
            ));
        }

        $query = $em->createQuery($dql);

        $firstResult = $input->getOption('first-result');
        if ($firstResult !== null) {
            if (! is_numeric($firstResult)) {
                throw new LogicException("Option 'first-result' must contain an integer value");
            }

            $query->setFirstResult((int) $firstResult);
        }

        $maxResult = $input->getOption('max-result');
        if ($maxResult !== null) {
            if (! is_numeric($maxResult)) {
                throw new LogicException("Option 'max-result' must contain an integer value");
            }

            $query->setMaxResults((int) $maxResult);
        }

        if ($input->getOption('show-sql')) {
            $ui->text($query->getSQL());

            return 0;

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Tools/Console/Command/RunDqlCommand.php:91 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/ce63db929c38be77. Report an issue: GitHub.