Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor docs' improvements #27

Merged
merged 5 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ composer require yiisoft/hydrator-validator

## General usage

Validating hydrator is a decorator for [hydrator](https://github.com/yiisoft/hydrator) that allows to validate object
after creating or populating with the decorated hydrator.
Validating hydrator is a decorator for [hydrator](https://github.com/yiisoft/hydrator):

To use it, the object being validated must implement `ValidatedInputInterface`. You can use `ValidatedInputTrait` to
easily create such object. The validation rules for raw values of the object that must be validated before hydration are
defined with `Validate` PHP attribute.
- it allows to validate raw data of properties marked with `Validate` PHP attribute before passing it to the decorated
arogachev marked this conversation as resolved.
Show resolved Hide resolved
hydrator;
- it allows to validate object after creating or populating it.

To use it, the object being validated must implement `ValidatedInputInterface`. You can use `ValidatedInputTrait` to
easily create such object. The validation rules for raw values of the object are defined with `Validate` PHP attribute.

Example of object:

Expand Down
6 changes: 5 additions & 1 deletion src/ValidatingHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
use Yiisoft\Validator\ValidatorInterface;

/**
* `ValidatingHydrator` is a decorator for {@see HydratorInterface} that validates data after hydration.
* `ValidatingHydrator` is a decorator for {@see HydratorInterface}:
*
* - it allows to validate raw data of properties marked with {@see Validate} PHP attribute before passing it to the
* decorated hydrator;
* - it allows to validate object after creating or populating it.
*/
final class ValidatingHydrator implements HydratorInterface
{
Expand Down
Loading