You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using MySQL. To represent a boolean value, I need to use MySQL bool (which appears to just by tinyint) or a bit (0/1). I prefer using bit, but it doesn't appear that this is supported by the yii2 table schema. (Correct me if wrong because that would solve this directly.)
Anyway, if I run gii/enhanced-gii-model against a column of tinyint, it is creating a rules[] with a type of string and max of 1. That will break normal code trying to use the field as a boolean. To fix this, I change yii2-enhanced-gii/model/Generator.php like so:
I am using MySQL. To represent a boolean value, I need to use MySQL bool (which appears to just by tinyint) or a bit (0/1). I prefer using bit, but it doesn't appear that this is supported by the yii2 table schema. (Correct me if wrong because that would solve this directly.)
Anyway, if I run gii/enhanced-gii-model against a column of tinyint, it is creating a rules[] with a type of string and max of 1. That will break normal code trying to use the field as a boolean. To fix this, I change yii2-enhanced-gii/model/Generator.php like so:
yii2-enhanced-gii now produces this output:
[['oplock', 'is_active'], 'boolean'],
Which is correct (for my situation).
Is there a better way? If not, would you be open to a PR to implement this with a switch like --use-tinyint-as-boolean ?
The text was updated successfully, but these errors were encountered: