mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-13 04:38:03 +08:00
@@ -267,6 +267,9 @@ $customer->save(); // equivalent to $customer->update();
|
|||||||
$customer = Customer::findOne($id);
|
$customer = Customer::findOne($id);
|
||||||
$customer->delete();
|
$customer->delete();
|
||||||
|
|
||||||
|
// to delete several customers
|
||||||
|
Customer::deleteAll('age > :age AND gender = :gender', [':age' => 20, ':gender' => 'M']);
|
||||||
|
|
||||||
// to increment the age of ALL customers by 1
|
// to increment the age of ALL customers by 1
|
||||||
Customer::updateAllCounters(['age' => 1]);
|
Customer::updateAllCounters(['age' => 1]);
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user