Yii2 update with multiple conditions
$this->localdb->createCommand() ->update( $this->MYTable, [ 'name' => $el['new'], 'data' => $el['data'], ], [ 'userId', $this->user, 'product_id', $this->productId, 'name', $el['old'], 'created', $el['date'], 'category', $el['cat'], ] ); I tried to use the following command to update a row using multiple where conditions, but it doesn't work for some reason. The documentation doesn't seem to cover this case and doesn't seem to be updated, because the update() method seems to match the updateAll method instead of the update method for some reason (maybe it was updated?). So I was wondering what was the correct way to do this.
You have a syntax error. Try following: $this->localdb->createCommand() ->update( $this->MYTable, [ 'name' => $el['new'], 'data' => $el['data'], ], [ 'userId' => $this->user, 'product_id' => $this->productId, 'name' => $el['old'], 'created' => $el['date'], 'category' => $el['cat'], ] );
How display Yii2 pagination in GridView widget on and top and bottom part of table?
How to print converted SQL query from yii2 query
Calculate from 3 inputfield in dynamic form yii2
Create pdf in Yii2 using mpdf extension: controller - view code
Kartik file input Post as file name, not as file object
Add class to bootstrap textbox - yii2
Set enablePushState = false on specific urls inside Pjax container (Yii2)
Yii2 select dropdown text
Redirecting on if condition in yii2
Using from another table for radioList's select options
How do I setup the reset password function on Yii2?
i want to use a toggle switch for active inactive status, i want to use in yii2 curd index page, i have added a widget toggle
How to save current user_id to database (YII2)
How to add whole directory to js section in asset bundle yii2
Yii2 - How can I add a search in Dropdownlist Widget
Show only 5 item in yii2 List view