Skip to content

Commit 9b0c334

Browse files
Fix non-supported method.
1 parent 64a62d7 commit 9b0c334

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Utils/TableFieldsGenerator.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ public function __construct($tableName, $ignoredFields, $connection = '')
6464
$this->tableName = $tableName;
6565
$this->ignoredFields = $ignoredFields;
6666

67-
if (!empty($connection)) {
68-
$this->schemaManager = DB::connection($connection)->getDoctrineSchemaManager();
67+
$connectionInstance = DB::connection($connection ?: null);
68+
69+
if (method_exists($connectionInstance, 'getDoctrineConnection')) {
70+
// Laravel 11+ preferred method
71+
$this->schemaManager = $connectionInstance
72+
->getDoctrineConnection()
73+
->createSchemaManager();
6974
} else {
70-
$this->schemaManager = DB::getDoctrineSchemaManager();
75+
// Laravel <11 fallback (optional)
76+
$this->schemaManager = $connectionInstance->getDoctrineSchemaManager();
7177
}
7278

7379
$platform = $this->schemaManager->getDatabasePlatform();

0 commit comments

Comments
 (0)