Open
Description
Hello. I got table in MySQL with default blank string value. In SQL it looks like:
`key` TINYTEXT NOT NULL DEFAULT '',
In the model i set rule with blank string as default value:
[['key'], 'default', 'value' => ''],
And i try to do simple form with it
<?= $form->field($model, 'key')->textarea(['rows' => 6]) ?>
In the form i see textarea with two single quotes as default value.
All fields with default blank string value got this bug.
My connection params:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=xxx',
'username' => 'xxx',
'password' => 'xxx',
'charset' => 'utf8',
];
How can i fix it?
I try to dump $model->key before form display and got this value - two single quotes.
I seen ActiveRecord::loadDefaultValues and tried dump there - got this bug there.
I found only one decision - set no default value and set blank string in the model code. But this is no right because i got other soft works with this db and it use default values.
Yii v2, PHP v8.3.13
Metadata
Metadata
Assignees
Labels
No labels