doctrine/orm · error · BadMethodCallException

The setSchema() method requires the DBAL Schema::edit() API

Error message

The setSchema() method requires the DBAL Schema::edit() API which is not available in the current DBAL version. This feature requires doctrine/dbal ^4.5 or higher.

What it means

Error "The setSchema() method requires the DBAL Schema::edit() API which is not available in the current DBAL version. This feature requires doctrine/dbal ^4.5 or higher." thrown in doctrine/orm.

Source

Thrown at src/Tools/Event/GenerateSchemaEventArgs.php:41

        private Schema $schema,
    ) {
    }

    public function getEntityManager(): EntityManagerInterface
    {
        return $this->em;
    }

    public function getSchema(): Schema
    {
        return $this->schema;
    }

    public function setSchema(Schema $schema): void
    {
        // @phpstan-ignore function.impossibleType (Checking for unreleased Schema::edit() API)
        if (! method_exists(Schema::class, 'edit')) {
            throw new BadMethodCallException(
                'The setSchema() method requires the DBAL Schema::edit() API which is not available in the current DBAL version. '
                . 'This feature requires doctrine/dbal ^4.5 or higher.',
            );
        }

        $this->schema = $schema;
    }
}

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Tools/Event/GenerateSchemaEventArgs.php:41 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/03f510f58638a383. Report an issue: GitHub.