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'], ] );
yii2 internal server error when uploaded to live server. What is wrong?
Making Yii2 as SSO server
Yii2, how to use bootstrap less in yii2 project?
Handle runtime exception in yii2 in rbac
How to get list of controller in frontend from backend in Yii2 Advanced Template?
How to insert same data record to multiple table on Yii2
Yii2 radio button validation is not working
keep filters/sort status when changing page and go back
How to open in a new window for a submit button?
How to add google-chart correctly in Yii2?
Multiple relations in Yii 2.0 ActiveRecord Model
controller action with different render view base on contest page
Will mPDF show font Awesome Icons?
yii2 disable access by right part of routing rule
Add Logo & Title to NavBar (Yii2)
Yii2 access to actions in new controllers