diff --git a/docs/en/cookbook/mysql-enums.rst b/docs/en/cookbook/mysql-enums.rst index 1d8df9259..1765ecc90 100644 --- a/docs/en/cookbook/mysql-enums.rst +++ b/docs/en/cookbook/mysql-enums.rst @@ -98,7 +98,7 @@ For example for the previous enum type: public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { - return sprintf("ENUM('visible', 'invisible') COMMENT '(DC2Type:%s)'", self::ENUM_VISIBILITY); + return "ENUM('visible', 'invisible')"; } public function convertToPHPValue($value, AbstractPlatform $platform) @@ -118,6 +118,11 @@ For example for the previous enum type: { return self::ENUM_VISIBILITY; } + + public function requiresSQLCommentHint(AbstractPlatform $platform) + { + return true; + } } You can register this type with ``Type::addType('enumvisibility', 'MyProject\DBAL\EnumVisibilityType');``. @@ -152,7 +157,7 @@ You can generalize this approach easily to create a base class for enums: { $values = array_map(function($val) { return "'".$val."'"; }, $this->values); - return "ENUM(".implode(", ", $values).") COMMENT '(DC2Type:".$this->name.")'"; + return "ENUM(".implode(", ", $values).")"; } public function convertToPHPValue($value, AbstractPlatform $platform) @@ -172,6 +177,11 @@ You can generalize this approach easily to create a base class for enums: { return $this->name; } + + public function requiresSQLCommentHint(AbstractPlatform $platform) + { + return true; + } } With this base class you can define an enum as easily as: