doctrine/orm · error · RuntimeException

Hydration mode '%s' does not exist. It should be either: obj

Error message

Hydration mode '%s' does not exist. It should be either: object. array, scalar or single-scalar.

What it means

Error "Hydration mode '%s' does not exist. It should be either: object. array, scalar or single-scalar." thrown in doctrine/orm.

Source

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

        $em = $this->getEntityManager($input);

        $dql = $input->getArgument('dql');
        if ($dql === null) {
            throw new RuntimeException("Argument 'dql' is required in order to execute this command correctly.");
        }

        $depth = $input->getOption('depth');

        if (! is_numeric($depth)) {
            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) {

View on GitHub (pinned to d9b9ff7301)

When it happens

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