Skip to content

Commit b8197ac

Browse files
committed
Update readme
1 parent 3e09f00 commit b8197ac

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,8 @@ class into instances of another class.
226226

227227
### CakePHP Validator
228228

229-
The [cakephp/validation](https://github.com/cakephp/validation) library provides features to build validators that can
230-
validate arbitrary arrays of data with ease.
231-
232-
The `$validator->validate()` method will return a non-empty array when there are validation failures. The returned array
233-
of errors then can be converted into a `ValidationResult`
234-
using the `CakeValidationErrorCollector`.
235-
236-
For example, if you wanted to validate a contact form before creating and sending an email you could do the following.
229+
The [cakephp/validation](https://github.com/cakephp/validation) library provides features
230+
to build validators that can validate arbitrary arrays of data with ease.
237231

238232
**Installation**
239233

@@ -243,10 +237,12 @@ composer require cakephp/validation
243237

244238
**Usage**
245239

246-
The `CakeValidationFactory` class to simplifies the validation handling.
247-
Please note: In real life the `CakeValidationFactory` should be injected via constructor.
240+
The `Cake\Validation\Validator::validate()` method returns a non-empty array when
241+
there are validation failures. The list of errors then can be converted into
242+
a `ValidationResult` using the `Selective\Validation\Factory\CakeValidationFactory`
243+
or `Selective\Validation\Converter\CakeValidationConverter`.
248244

249-
**Factory usage**
245+
For example, if you want to validate a login form you could do the following:
250246

251247
```php
252248
use Selective\Validation\Factory\CakeValidationFactory;
@@ -273,6 +269,8 @@ if ($validationResult->fails()) {
273269
}
274270
```
275271

272+
Please note: The `CakeValidationFactory` should be injected via constructor.
273+
276274
**Read more:** <https://odan.github.io/2020/10/18/slim4-cakephp-validation.html>
277275

278276
### Symfony Validator

0 commit comments

Comments
 (0)