Skip to content

Commit

Permalink
Fix COLUMN_NAME and column_name
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarafdev committed Aug 28, 2020
1 parent 9dc20d1 commit 0ef87e8
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/OscarAFDev/MigrationsGenerator/Generators/FieldGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ protected function getEnum($table)
* @param string $table
* @return array
*/
protected function setEnum(array $fields, $table)
{
foreach ($this->getEnum($table) as $column) {
$fields[$column->COLUMN_NAME]['type'] = 'enum';
$fields[$column->COLUMN_NAME]['args'] = str_replace('enum(', 'array(', $column->COLUMN_TYPE);
}
return $fields;
}
protected function setEnum(array $fields, $table)
{
foreach ($this->getEnum($table) as $column) {
if (isset($column->COLUMN_NAME)) {
$fields[$column->COLUMN_NAME]['type'] = 'enum';
$fields[$column->COLUMN_NAME]['args'] = str_replace('enum(', 'array(', $column->COLUMN_TYPE);
} elseif (isset($column->column_name)) {
$fields[$column->column_name]['type'] = 'enum';
$fields[$column->column_name]['args'] = str_replace('enum(', 'array(', $column->column_type);
}
}
return $fields;
}

/**
* @param \Doctrine\DBAL\Schema\Column[] $columns
Expand Down

0 comments on commit 0ef87e8

Please sign in to comment.