laravel
laravel copied to clipboard
Laravel 11 support
I got an error when I did update to Laravel11, please find the error message
BadMethodCallException
Method Illuminate\Database\MySqlConnection::getDoctrineSchemaManager does not exist.
at vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:112
108▕ */
109▕ public function __call($method, $parameters)
110▕ {
111▕ if (! static::hasMacro($method)) {
➜ 112▕ throw new BadMethodCallException(sprintf(
113▕ 'Method %s::%s does not exist.', static::class, $method
114▕ ));
115▕ }
116▕
i Bad Method Call: Did you mean Illuminate\Database\MySqlConnection::getSchemaGrammar() ?
1 vendor\reliese\laravel\src\Meta\MySql\Schema.php:273
Illuminate\Database\Connection::__call("getDoctrineSchemaManager", [])
2 [internal]:0
Reliese\Meta\MySql\Schema::schemas(Object(Illuminate\Database\MySqlConnection))
https://github.com/laravel/framework/pull/48864
Removes DB::getDoctrineSchemaManager() method
you can modify like this , it cause doctrine types not supported on laravel 11
https://github.com/reliese/laravel/pull/208
@uacode This is explaining why the error is being thrown. But, how to solve it?
@osama-98 I commented in vendor (only for run DB migrations)
\Reliese\Meta\MySql\Schema::schemas
public static function schemas(Connection $connection)
{
// $schemas = $connection->getDoctrineSchemaManager()->listDatabases();
// Schema::getDatabases();
$schemas = [];
return array_diff($schemas, [
'information_schema',
'sys',
'mysql',
'performance_schema',
]);
}
@uacode This is explaining why the error is being thrown. But, how to solve it?
I resolved it on PR #208 you can direct edit your vendor folder
Could somebody please review and merge? New Laravel devs cannot use this as they start with Laravel 11 and will be forced to make their own Model files: 1 for each table.
@igun997 Your PR doesn't fix the issue completely. There are still calls to the getDoctrineSchemaManager (in ...Postgres/Schema.php) which was removed in v11.
@igun997 Your PR doesn't fix the issue completely. There are still calls to the getDoctrineSchemaManager (in ...Postgres/Schema.php) which was removed in v11.
ah , i forget about it. coz i use mysql & mariadb as primary databases
any update on this? as still I am getting the Method Illuminate\Database\MySqlConnection::getDoctrineSchemaManager does not exist. error while runing the php artisan code:models command
any update on this? as still I am getting the
Method Illuminate\Database\MySqlConnection::getDoctrineSchemaManager does not exist.error while runing thephp artisan code:modelscommand
Look a couple of comments back, this workaround works.
https://github.com/reliese/laravel/issues/273#issuecomment-2016756918
any update on this? as still I am getting the
Method Illuminate\Database\MySqlConnection::getDoctrineSchemaManager does not exist.error while runing thephp artisan code:modelscommand
same error here
This should be resolved by #208. Apologies on the delay in getting this merged.
Still Facing the Same issue with laravel 11, sqlite and php 8.2
Still seeing the same issue also with sqlite (PHP 8.3 and Laravel 11) - the workaround shown above appears to be for MySQL not sqlite. Is there a workaround for SQLite?
Hi Guys, here is how to fix the problem with Postgres: 1.- go to this folder: vendor/reliese/laravel/src/Meta/Postgres and edit the file Schema.php 2.- edit the function "schemas" with this change:
public static function schemas(Connection $connection)
{
// $schemas = $connection->getDoctrineSchemaManager()->listDatabases();
$schemas = $connection->select('SELECT schema_name FROM information_schema.schemata');
$schemas = array_column($schemas, 'schema_name');
return array_diff($schemas, [
'postgres',
'template0',
'template1',
]);
}
3.- save this file and run the command php artisan code:models again.
You are all set, that's it!
Editing a vendor file is not a fix. I was using this method to get indexes on a table. I will need to find a new way.