added param binding examples for update() and delete()

fixes #14218
This commit is contained in:
Carsten Brandt
2017-06-07 23:19:47 +02:00
parent a3501ed831
commit fddb34b91c

View File

@ -472,6 +472,13 @@ class Command extends Component
* $connection->createCommand()->update('user', ['status' => 1], 'age > 30')->execute();
* ```
*
* or with using parameter binding for the condition:
*
* ```php
* $minAge = 30;
* $connection->createCommand()->update('user', ['status' => 1], 'age > :minAge', [':minAge' => $minAge])->execute();
* ```
*
* The method will properly escape the column names and bind the values to be updated.
*
* Note that the created command is not executed until [[execute()]] is called.
@ -498,6 +505,13 @@ class Command extends Component
* $connection->createCommand()->delete('user', 'status = 0')->execute();
* ```
*
* or with using parameter binding for the condition:
*
* ```php
* $status = 0;
* $connection->createCommand()->delete('user', 'status = :status', [':status' => $status])->execute();
* ```
*
* The method will properly escape the table and column names.
*
* Note that the created command is not executed until [[execute()]] is called.