reliese / laravel

Reliese Laravel Model Generator
MIT License
1.41k stars 308 forks source link

Laravel 11 support #273

Closed osama-98 closed 1 month ago

osama-98 commented 3 months ago

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))
uacode commented 3 months ago

https://github.com/laravel/framework/pull/48864

Removes DB::getDoctrineSchemaManager() method

igun997 commented 3 months ago

you can modify like this , it cause doctrine types not supported on laravel 11

https://github.com/reliese/laravel/pull/208

osama-98 commented 3 months ago

@uacode This is explaining why the error is being thrown. But, how to solve it?

uacode commented 3 months ago

@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',
        ]);
    }
igun997 commented 3 months ago

@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

vibonacci commented 2 months ago

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.

alphageek01 commented 2 months ago

@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 commented 2 months ago

@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

aavinseth commented 1 month ago

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

realitymatters commented 1 month ago

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

Look a couple of comments back, this workaround works.

https://github.com/reliese/laravel/issues/273#issuecomment-2016756918

alexlpdj commented 1 month ago

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

same error here

finiteinfinity commented 1 month ago

This should be resolved by #208. Apologies on the delay in getting this merged.