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 use runAction() within beforeAction method
Yii2-user, dektrium-yii2-user, Yii2 Populate a dropdown in yii2
Yii2: How to start an export programmatically
Getting field value in controller
display setFlash on spesific div
Yii 2 vendor trouble
Yii2 - module login in basic application template
Yii2 and sqldataprovider in inner query, write one aggregating expression per reporting column, 2. In an outer query, build the horizontal sums
Yii2. What is the best practice to manage new messages?
How to load jquery files on header in Yii2?
Getting (not set) when joining a column which has a sum function in yii2
Time is wrong when get datetime in yii2
Yii2 get app web url without index.php
How to get max and min date in Yii 2
How can I Implement HTTPS for all pages Yii2
Yii2 RBAC Rule Feedback / Message