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 HTML purifier
Yii2 pjax & NavBar - links not working
Yii2 Multi-Tenant Architecture - Choose correct database
Send mail on actionCreate
Is it possible to reference an existing ActiveRecord model from the classes generated with Gii?
Yii2 Rbac not able to add new roles
Insert checked rows from a gridview to a table in yii2
how to track changes of relation between two models in yii2
Yii2 get value before save in model
How to prevent malicious file upload?
How can i access Active Record fields in yii2 framework?
Send message over SMTP using Swiftmailer and Yii2
Yii2 Api user validation with query string
Yii2 attempts to re-apply old migration files
Set Dropdown list width in yii2
Yii2 api username password validation