doctrine/orm · error · InvalidArgumentException

%d is not a valid value for $mode

Error message

%d is not a valid value for $mode

What it means

Error "%d is not a valid value for $mode" thrown in doctrine/orm.

Source

Thrown at src/Query/ResultSetMappingBuilder.php:187

        }

        return ! ($classMetadata->isInheritanceTypeSingleTable() || $classMetadata->isInheritanceTypeJoined());
    }

    /**
     * Gets column alias for a given column.
     *
     * @phpstan-param array<string, string>  $customRenameColumns
     *
     * @phpstan-assert self::COLUMN_RENAMING_* $mode
     */
    private function getColumnAlias(string $columnName, int $mode, array $customRenameColumns): string
    {
        return match ($mode) {
            self::COLUMN_RENAMING_INCREMENT => $columnName . $this->sqlCounter++,
            self::COLUMN_RENAMING_CUSTOM => $customRenameColumns[$columnName] ?? $columnName,
            self::COLUMN_RENAMING_NONE => $columnName,
            default => throw new InvalidArgumentException(sprintf('%d is not a valid value for $mode', $mode)),
        };
    }

    /**
     * Retrieves a class columns and join columns aliases that are used in the SELECT clause.
     *
     * This depends on the renaming mode selected by the user.
     *
     * @param class-string $className
     * @phpstan-param self::COLUMN_RENAMING_* $mode
     * @phpstan-param array<string, string> $customRenameColumns
     *
     * @return string[]
     */
    private function getColumnAliasMap(
        string $className,
        int $mode,
        array $customRenameColumns,

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Query/ResultSetMappingBuilder.php:187 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/f8db4bad43741af5. Report an issue: GitHub.