Skip to content

Commit

Permalink
Fixes yiisoft#16108: Use less confusing syntax [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark authored Apr 16, 2018
1 parent 1498432 commit 033f2b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/guide/input-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ which supports declaring both attributes and rules on the fly. Its usage is like
```php
public function actionSearch($name, $email)
{
$model = DynamicModel::validateData(compact('name', 'email'), [
$model = DynamicModel::validateData(['name' => $name, 'email' => $email]), [
[['name', 'email'], 'string', 'max' => 128],
['email', 'email'],
]);
Expand All @@ -316,7 +316,7 @@ Alternatively, you may use the following more "classic" syntax to perform ad hoc
```php
public function actionSearch($name, $email)
{
$model = new DynamicModel(compact('name', 'email'));
$model = new DynamicModel(['name' => $name, 'email' => $email]);
$model->addRule(['name', 'email'], 'string', ['max' => 128])
->addRule('email', 'email')
->validate();
Expand Down

0 comments on commit 033f2b4

Please sign in to comment.