Closed Daizygod closed 2 months ago
- Set up empty laravel project
- Config PostgreSQL database
- Create sample table
- try
php artisan code:models --table=your_sample_table
Get error:
BadMethodCallException Method Illuminate\Database\PostgresConnection::getDoctrineSchemaManager does not exist. at vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:115 111▕ */ 112▕ public function __call($method, $parameters) 113▕ { 114▕ if (! static::hasMacro($method)) { ➜ 115▕ throw new BadMethodCallException(sprintf( 116▕ 'Method %s::%s does not exist.', static::class, $method 117▕ )); 118▕ } 1 vendor\reliese\laravel\src\Meta\Postgres\Schema.php:286 Illuminate\Database\Connection::__call("getDoctrineSchemaManager", []) 2 [internal]:0 Reliese\Meta\Postgres\Schema::schemas(Object(Illuminate\Database\PostgresConnection))
My way to fix this:
in
src/Meta/Postgres/Schema.php
orvendor/reliese/laravel/src/Meta/Postgres/Schema.php
in method
public static function schemas(Connection $connection)
change from
public static function schemas(Connection $connection) { $schemas = $connection->getDoctrineSchemaManager()->listDatabases(); return array_diff($schemas, [ 'postgres', 'template0', 'template1', ]); }
to this
public static function schemas(Connection $connection) { $schemas = array_column($connection->getSchemaBuilder()->getTables(), 'name'); return array_diff($schemas, [ 'postgres', 'template0', 'template1', ]); }
This Actually worked!! Thanks alot.
May the team build this amazing plugin update thier code, since laravel 11 removed the support for getDoctrineSchemaManager
php artisan code:models --table=your_sample_table
Get error:
My way to fix this:
in
src/Meta/Postgres/Schema.php
orvendor/reliese/laravel/src/Meta/Postgres/Schema.php
in method
public static function schemas(Connection $connection)
change from
to this