Skip to content

Commit 2c2dfd7

Browse files
authored
Remove options that no longer can be set with DBAL 3 (#3)
1 parent d7ad8d2 commit 2c2dfd7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

EventSubscriber/CreateSchemaSubscriber.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs)
6868
/* @var $column Column */
6969
$column = $entityTable->getColumn('id');
7070
$revisionTable->addColumn($column->getName(), $column->getType()->getName(), array_merge(
71-
$column->toArray(),
71+
$this->getColumnOptions($column),
7272
array('notnull' => false, 'autoincrement' => false)
7373
));
7474
}
@@ -82,7 +82,7 @@ public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs)
8282
if ($column->getName() == 'id') continue;
8383
/* @var $column Column */
8484
$revisionTable->addColumn($column->getName(), $column->getType()->getName(), array_merge(
85-
$column->toArray(),
85+
$this->getColumnOptions($column),
8686
array('notnull' => false, 'autoincrement' => false)
8787
));
8888
}
@@ -93,4 +93,17 @@ public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs)
9393
$revisionTable->setPrimaryKey($pkColumns);
9494
}
9595
}
96+
97+
/**
98+
* Get all the options for a column, uses the toArray method and removes the keys that are not relevant
99+
*/
100+
private function getColumnOptions(Column $column): array
101+
{
102+
$columnArray = $column->toArray();
103+
unset($columnArray['name']);
104+
unset($columnArray['type']);
105+
unset($columnArray['version']);
106+
107+
return $columnArray;
108+
}
96109
}

0 commit comments

Comments
 (0)