Skip to content

Commit f078a31

Browse files
author
Illia Sakovich
committed
fix generator for tables with enum fields
1 parent 175c56b commit f078a31

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/ColumnShouldBeIgnored.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public function __invoke(Column $column): bool
1212
return true;
1313
}
1414

15+
// enum
16+
if ($column->getType()->getName() === 'string' && $column->getLength() === 0) {
17+
return true;
18+
}
19+
1520
if ($column->getName() === 'deleted_at') {
1621
return true;
1722
}

src/FactoryGenerator.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ public function generate(Model $model): string
6969

7070
protected function table(Model $model): Table
7171
{
72-
return $this->connection
73-
->getDoctrineSchemaManager()
74-
->listTableDetails($model->getTable());
72+
$schemaManager = $this->connection
73+
->getDoctrineSchemaManager();
74+
75+
$schemaManager->getDatabasePlatform()
76+
->registerDoctrineTypeMapping('enum', 'string');
77+
78+
return $schemaManager->listTableDetails($model->getTable());
7579
}
7680

7781
protected function columns(Table $table): array

0 commit comments

Comments
 (0)