Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
61 changes: 35 additions & 26 deletions doc/book/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,34 +134,14 @@ if (! $validator->isValid('word')) {

## Translating messages

> ### Translation compatibility
>
> In versions 2.0 - 2.1, `Zend\Validator\AbstractValidator` implemented
> `Zend\I18n\Translator\TranslatorAwareInterface` and accepted instances of
> `Zend\I18n\Translator\Translator`. Starting in version 2.2.0, zend-validator
> now defines a translator interface, > `Zend\Validator\Translator\TranslatorInterface`,
> as well as it's own -aware variant, > `Zend\Validator\Translator\TranslatorAwareInterface`.
> This was done to reduce dependencies for the component, and follows the
> principal of Separated Interfaces.
>
> The upshot is that if you are migrating from a pre-2.2 version, and receiving
> errors indicating that the translator provided does not implement
> `Zend\Validator\Translator\TranslatorInterface`, you will need to make a
> change to your code.
> ### Installation requirements
>
> An implementation of `Zend\Validator\Translator\TranslatorInterface` is
> provided in `Zend\Mvc\I18n\Translator`, which also extends
> `Zend\I18n\Translator\Translator`. This version can be instantiated and used
> just as the original `Zend\I18n` version.
>
> A new service has also been registered with the MVC, `MvcTranslator`, which
> will return this specialized, bridge instance.
> The translation of validator messages depends on the zend-i18n component, so
> be sure to have it installed before getting started:
>
> Most users should see no issues, as `Zend\Validator\ValidatorPluginManager`
> has been modified to use the `MvcTranslator` service internally, which is how
> most developers were getting the translator instance into validators in the
> first place. You will only need to change code if you were manually injecting
> the instance previously.
> ```bash
> $ composer require zendframework/zend-i18n
> ```

Validator classes provide a `setTranslator()` method with which you can specify
an instance of `Zend\Validator\Translator\TranslatorInterface` which will
Expand Down Expand Up @@ -211,3 +191,32 @@ if (! $validator->isTranslatorDisabled()) {
It is also possible to use a translator instead of setting own messages with
`setMessage()`. But doing so, you should keep in mind, that the translator works
also on messages you set your own.

> ### Translation compatibility
>
> In versions 2.0 - 2.1, `Zend\Validator\AbstractValidator` implemented
> `Zend\I18n\Translator\TranslatorAwareInterface` and accepted instances of
> `Zend\I18n\Translator\Translator`. Starting in version 2.2.0, zend-validator
> now defines a translator interface, > `Zend\Validator\Translator\TranslatorInterface`,
> as well as it's own -aware variant, > `Zend\Validator\Translator\TranslatorAwareInterface`.
> This was done to reduce dependencies for the component, and follows the
> principal of Separated Interfaces.
>
> The upshot is that if you are migrating from a pre-2.2 version, and receiving
> errors indicating that the translator provided does not implement
> `Zend\Validator\Translator\TranslatorInterface`, you will need to make a
> change to your code.
>
> An implementation of `Zend\Validator\Translator\TranslatorInterface` is
> provided in `Zend\Mvc\I18n\Translator`, which also extends
> `Zend\I18n\Translator\Translator`. This version can be instantiated and used
> just as the original `Zend\I18n` version.
>
> A new service has also been registered with the MVC, `MvcTranslator`, which
> will return this specialized, bridge instance.
>
> Most users should see no issues, as `Zend\Validator\ValidatorPluginManager`
> has been modified to use the `MvcTranslator` service internally, which is how
> most developers were getting the translator instance into validators in the
> first place. You will only need to change code if you were manually injecting
> the instance previously.
11 changes: 11 additions & 0 deletions doc/book/validator-chains.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Validator Chains

## Basic Usage

> ### Installation requirements
>
> The validator chain depends on the zend-servicemanager component, so be sure
> to have it installed before getting started:
>
> ```bash
> $ composer require zendframework/zend-servicemanager
> ```

Often, multiple validations should be applied to some value in a particular
order. The following code demonstrates a way to solve the example from the
[introduction](intro.md), where a username must be between 6 and 12 alphanumeric
Expand Down
2 changes: 1 addition & 1 deletion doc/book/validators/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ given value.
> getting started:
>
> ```bash
> $ composer require zendframework/zend-db`
> $ composer require zendframework/zend-db
> ```

## Supported options
Expand Down
2 changes: 1 addition & 1 deletion doc/book/validators/digits.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
> have it installed before getting started:
>
> ```bash
> $ composer require zendframework/zend-filter`
> $ composer require zendframework/zend-filter
> ```

## Supported options
Expand Down
2 changes: 1 addition & 1 deletion doc/book/validators/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internally.
> have it installed before getting started:
>
> ```bash
> $ composer require zendframework/zend-uri`
> $ composer require zendframework/zend-uri
> ```

## Priority
Expand Down