Skip to content

Commit 8314357

Browse files
authored
Merge pull request #131 from dotkernel/issue127
moved filter name to Input constructor
2 parents 71579ff + 8a97fbd commit 8314357

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

docs/book/v6/tutorials/create-book-module-via-dot-maker.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ We create separate `Input` files to demonstrate their reusability and obtain a c
325325
> Note that `dot-maker` will not generate inputs in the constructor, so the following are to be added by hand **if** going for this approach.
326326
327327
```php
328-
$nameInput = new Input();
328+
$nameInput = new Input('name');
329329
$nameInput->setRequired(true);
330330

331331
$nameInput->getFilterChain()
@@ -337,9 +337,9 @@ $nameInput->getValidatorChain()
337337
'message' => Message::VALIDATOR_REQUIRED_FIELD,
338338
], true);
339339

340-
$this->add($nameInput, 'name');
340+
$this->add($nameInput);
341341

342-
$authorInput = new Input();
342+
$authorInput = new Input('author');
343343
$authorInput->setRequired(true);
344344

345345
$authorInput->getFilterChain()
@@ -351,9 +351,9 @@ $authorInput->getValidatorChain()
351351
'message' => Message::VALIDATOR_REQUIRED_FIELD,
352352
], true);
353353

354-
$this->add($authorInput, 'author');
354+
$this->add($authorInput);
355355

356-
$releaseDateInput = new Input();
356+
$releaseDateInput = new Input('releaseDate');
357357
$releaseDateInput->setRequired(true);
358358

359359
$releaseDateInput->getFilterChain()
@@ -365,7 +365,7 @@ $releaseDateInput->getValidatorChain()
365365
'message' => Message::VALIDATOR_REQUIRED_FIELD,
366366
], true);
367367

368-
$this->add($releaseDateInput, 'releaseDate');
368+
$this->add($releaseDateInput);
369369
```
370370

371371
## Migrations

docs/book/v6/tutorials/create-book-module.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class CreateBookInputFilter extends AbstractInputFilter
430430
We create separate `Input` files to demonstrate their reusability and obtain a clean `CreateBookInputFilter` but you could have all the inputs created directly in the `CreateBookInputFilter` like this:
431431

432432
```php
433-
$nameInput = new Input();
433+
$nameInput = new Input('name');
434434
$nameInput->setRequired(true);
435435

436436
$nameInput->getFilterChain()
@@ -442,9 +442,9 @@ $nameInput->getValidatorChain()
442442
'message' => Message::VALIDATOR_REQUIRED_FIELD,
443443
], true);
444444

445-
$this->add($nameInput, 'name');
445+
$this->add($nameInput);
446446

447-
$authorInput = new Input();
447+
$authorInput = new Input('author');
448448
$authorInput->setRequired(true);
449449

450450
$authorInput->getFilterChain()
@@ -456,9 +456,9 @@ $authorInput->getValidatorChain()
456456
'message' => Message::VALIDATOR_REQUIRED_FIELD,
457457
], true);
458458

459-
$this->add($authorInput, 'author');
459+
$this->add($authorInput);
460460

461-
$releaseDateInput = new Input();
461+
$releaseDateInput = new Input('releaseDate');
462462
$releaseDateInput->setRequired(true);
463463

464464
$releaseDateInput->getFilterChain()
@@ -470,7 +470,7 @@ $releaseDateInput->getValidatorChain()
470470
'message' => Message::VALIDATOR_REQUIRED_FIELD,
471471
], true);
472472

473-
$this->add($releaseDateInput, 'releaseDate');
473+
$this->add($releaseDateInput);
474474
```
475475

476476
Now it's time to create the handlers.

0 commit comments

Comments
 (0)