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 assign values according to the previous ones
yii2 action colum hidden still visible
Yii2 deployment on Hostgator Cpanel VPS server not working
Yii2 property mapping to tablename
Yii2 migration cant create DataBase
Yii2 wbrangca dynamic form widget with 2 different related models
kartik GridView link data tags in ActionColumn
heredoc yii2 is that support cause i got internal server error [duplicate]
Yii2 , How to save the logged in user's username in another table automatically?
Yii2 - Update database field when switchinput widget is clicked
Undefined class constant error in yii2 [closed]
How to Enable AjaxValidtion for Specific Filed in yii2
Kartik select2 yii2 - Select All and Unselected All is not connected with select, selecting, unselect event
Yii2: Defining a REST API Parameter other than 'ID'
using pjax for toasts without full refresh
activeform client validation with pjax