Skip to content

Conversation

@IlhamriSKY
Copy link

This PR addresses a compatibility issue when using Laravel 11.x with the orangehill/iseed package.

In Laravel 11, calling getDoctrineSchemaManager() on a database connection throws the following error:

BadMethodCallException: Method Illuminate\Database\MySqlConnection::getDoctrineSchemaManager does not exist.

Even after installing doctrine/dbal, the method is not exposed unless accessed via a Doctrine connection manually. Additionally, $this->databaseName can be null, which causes:

Trying to access array offset on null

…when fetching connection configuration.

✅ Solution

  • Fallback to Laravel's default database connection when $this->databaseName is null.
  • Use Doctrine DBAL directly via DriverManager::getConnection() and createSchemaManager() to ensure compatibility with Laravel 11 and DBAL v3.

✅ Tested on:

  • Laravel 11.44.2
  • Doctrine DBAL ^3.6

@IlhamriSKY IlhamriSKY changed the title Fix getDoctrineSchemaManager compatibility with Laravel 11 and Doctrine DBAL 3+ Fix: getDoctrineSchemaManager compatibility with Laravel 11 and Doctrine DBAL 3+ Apr 14, 2025
@leonardocustodio
Copy link

Any reasons why this was not merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants