I was used to create EnumType using a EnumSubscriber::postGenerateSchema; This subscriber was using CommentHint. This has been removed from dbal in the commit 4134b86cb986f6fc68fe9ba7c8a7416debfa22bd.
<?php
namespace App\DatabaseSubscriber;
use App\Database\Type\EnumType;
use Doctrine\DBAL\Schema\Column;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
class EnumSubscriber
{
public function postGenerateSchema(GenerateSchemaEventArgs $eventArgs)
{
$columns = [];
foreach ($eventArgs->getSchema()->getTables() as $table) {
foreach ($table->getColumns() as $column) {
if ($column->getType() instanceof EnumType) {
$columns[] = $column;
}
}
}
/** @var Column $column */
foreach ($columns as $column) {
$enum = $column->getType();
$column->setComment(trim(sprintf('%s (%s)', $column->getComment(), implode(',', $enum::getPermittedValues()))));
}
}
}
Current behaviour
Current behavior, makes db schema update infinitely refreshing.
How to reproduce
Just create a EnumType following; and use postGenerateSchema subscriber.
Expected behaviour
I would expect to restore in AbstractSchemaManager.php:
public function removeDoctrineTypeFromComment($comment, $type)
public function extractDoctrineTypeFromComment($comment, $currentType)
Then restore on every platform,
$type = $this->platform->getDoctrineTypeMapping($dbType);
// In cases where not connected to a database DESCRIBE $table does not return 'Comment'
if (isset($tableColumn['comment'])) {
$type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type);
$tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type);
}
Unless this was suppressed on purpose, it was very useful feature to incorporate EnumType.
If an alternative is possible, please advice.
Bug Report
Summary
I was used to create EnumType using a
EnumSubscriber::postGenerateSchema
; This subscriber was using CommentHint. This has been removed from dbal in the commit4134b86cb986f6fc68fe9ba7c8a7416debfa22bd
.Current behaviour
Current behavior, makes db schema update infinitely refreshing.
How to reproduce
Just create a EnumType following; and use
postGenerateSchema
subscriber.Expected behaviour
I would expect to restore in
AbstractSchemaManager.php
:Then restore on every platform,
Unless this was suppressed on purpose, it was very useful feature to incorporate EnumType. If an alternative is possible, please advice.