Skip to content

Commit 239af81

Browse files
author
Nelson Arbelaez
committed
Add suport for doctrine/dbal:^4.0
1 parent 0374c8f commit 239af81

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"license": "MIT",
1212
"require": {
1313
"php": "^8.0",
14+
"doctrine/dbal": "^3.0|^4.0",
1415
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0"
1516
},
1617
"require-dev": {

src/Config/ModelConfig.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class ModelConfig
2020
public function __construct(Model $model)
2121
{
2222
$this->model = $model;
23-
$this->config = $this->hasConfig() ? $this->getConfig() : [];
24-
23+
$this->config = $this->hasConfig() ? $this->getConfig() : [];
2524
}
2625

2726

28-
public function getPrimaryColumn(): string {
27+
public function getPrimaryColumn(): string
28+
{
2929
$table = $this->model->getTable();
3030
$primaryKey = $this->model->getKeyName();
31-
return $table. '.'. $primaryKey;
31+
return $table . '.' . $primaryKey;
3232
}
3333

3434
/**
@@ -166,8 +166,11 @@ protected function registerEnumTypeForDoctrine($connection): void
166166
return;
167167
}
168168

169-
$connection
170-
->getDoctrineSchemaManager()
169+
$schema = method_exists($connection, 'createSchemaManager')
170+
? $connection->createSchemaManager()
171+
: $connection->getDoctrineSchemaManager();
172+
173+
$schema
171174
->getDatabasePlatform()
172175
->registerDoctrineTypeMapping('enum', 'string');
173176
}

0 commit comments

Comments
 (0)