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 extension: How to declare $sourcePath in assets?
Yii2 Mailchimp Integration
Unable to save model attribute as null?
How to add a placeholder to a dropdown in Yii2?
How to use a custom Controller in yii2?
How to disable one prompt value in yii2 drop-down?
How to set swiftmailer setFrom() to show name and surname instead of email? Yii2
Reflection Exception error caused while using a extension in yii2
use barebone Yii2 framework
yii2 rest api basic auth throws 401 unauthorized
How can I directly go to an action in the browser?
Yii2 - drag and drop file upload with widget kartik-v [closed]
yii2 dectrium rbac rule validation class does not exist
access a models component included relation tha result with another models yii2
Yii2 how can an model attribute is modified after load method? (like the afterFind method)
How to disable Create button to prevent multiple times the data to be saved in database in yii2