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'], ] );
Using implode in gridview yii2
How to upload same file in different folder?
Yii2 change redactor box size
How to search using SearchModel in Yii2?
negation in query condition yii2
yii2 General SQL Server error: Check messages from the SQL Server  (severity 16) [(null)]
Yii2 Summernote widget not working
yii2 bootstrap Nav keep parent active when child pointing to different module
Generate data-confirm not working
yii2 check database type (mysql or oracle)
Installing Yii2 - 403 Forbidden page
Data from two function in one column in gridview yii2
Write info message in app.log file using yii2
Add conditions in view, wich will get in sql query
Yii2 gridview: sending attribute value to filter
Count of each status in gridview yii2