Closed samizdam closed 4 years ago
@samizdam have you seen https://github.com/robmorgan/phinx/blob/0.5.x-dev/src/Phinx/Db/Adapter/AdapterInterface.php#L43?
Hm...Thanks! It's looks like what I want. But it not very useful out of Adapter package.
What you think about extract this enum to separate class, for example
Phinx\Db\Table\ColumnTypeEnum(Interface)
or
Phinx\Db\Adapter\DataType*
and reuse it (via implement
or simple import with use
) in AdapterInterface and MigrationInterface?
I think use self::TYPE_STRING
in concrete migrations will be helpful for users, who work with Phinx first time, and make this code readable.
And what you think about Options as constants?
P.S. Yes, this issue make code is more verbose. But find all usages of some type (for refactoring, or code inspection) will be easier, and code will becomes more abstract with Enum, to my mind.
Are you able to provide a patch with your suggested changes as PR?
Closing due to lack of activity or out of scope. If there is new interest, please open a PR.
Create some classes or interfaces with enums of valid options and types for columns, like: https://github.com/yiisoft/yii2/blob/master/framework/db/Schema.php#L45 or https://github.com/zendframework/zend-db/blob/master/src/Adapter/ParameterContainer.php#L18 or https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/Type.php#L36
Goals: