yii2
yii2 copied to clipboard
DB batchInsert doesn't support JSON (array) fields
PHP Warning ‘yii\base\ErrorException’ with message ‘Array to string conversion’
in vendor/yiisoft/yii2/db/QueryBuilder.php:485
Stack trace:
#0 vendor/yiisoft/yii2/db/QueryBuilder.php(485): yii\console\ErrorHandler->handleError(code: ‘...‘, message: ‘...‘, file: ‘...‘, line: ‘...‘)
#1 vendor/yiisoft/yii2/db/QueryBuilder.php(485): ::implode(separator: ‘...‘, array: ‘...‘)
#2 vendor/yiisoft/yii2/db/Command.php(525): yii\db\mysql\QueryBuilder->batchInsert(table: ‘...‘, columns: ‘...‘, rows: ‘...‘, params: ‘...‘)
Fixed: https://github.com/yiisoft/yii2/pull/20684/files
Are you sure it's JSON strings in all possible cases?
@samdark sorry didn't get your question
I was trying to save a record that had a field with array value
Yes. I've got the idea. Was just too much into Yii3 which supports more than a single way to store arrays.