Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 470d07f

Browse files
committed
Merge branch 'docs/270'
Close #270
2 parents e47b716 + 1ad54a5 commit 470d07f

File tree

5 files changed

+49
-29
lines changed

5 files changed

+49
-29
lines changed

doc/book/intro.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -134,34 +134,14 @@ if (! $validator->isValid('word')) {
134134

135135
## Translating messages
136136

137-
> ### Translation compatibility
138-
>
139-
> In versions 2.0 - 2.1, `Zend\Validator\AbstractValidator` implemented
140-
> `Zend\I18n\Translator\TranslatorAwareInterface` and accepted instances of
141-
> `Zend\I18n\Translator\Translator`. Starting in version 2.2.0, zend-validator
142-
> now defines a translator interface, > `Zend\Validator\Translator\TranslatorInterface`,
143-
> as well as it's own -aware variant, > `Zend\Validator\Translator\TranslatorAwareInterface`.
144-
> This was done to reduce dependencies for the component, and follows the
145-
> principal of Separated Interfaces.
146-
>
147-
> The upshot is that if you are migrating from a pre-2.2 version, and receiving
148-
> errors indicating that the translator provided does not implement
149-
> `Zend\Validator\Translator\TranslatorInterface`, you will need to make a
150-
> change to your code.
137+
> ### Installation requirements
151138
>
152-
> An implementation of `Zend\Validator\Translator\TranslatorInterface` is
153-
> provided in `Zend\Mvc\I18n\Translator`, which also extends
154-
> `Zend\I18n\Translator\Translator`. This version can be instantiated and used
155-
> just as the original `Zend\I18n` version.
156-
>
157-
> A new service has also been registered with the MVC, `MvcTranslator`, which
158-
> will return this specialized, bridge instance.
139+
> The translation of validator messages depends on the zend-i18n component, so
140+
> be sure to have it installed before getting started:
159141
>
160-
> Most users should see no issues, as `Zend\Validator\ValidatorPluginManager`
161-
> has been modified to use the `MvcTranslator` service internally, which is how
162-
> most developers were getting the translator instance into validators in the
163-
> first place. You will only need to change code if you were manually injecting
164-
> the instance previously.
142+
> ```bash
143+
> $ composer require zendframework/zend-i18n
144+
> ```
165145
166146
Validator classes provide a `setTranslator()` method with which you can specify
167147
an instance of `Zend\Validator\Translator\TranslatorInterface` which will
@@ -211,3 +191,32 @@ if (! $validator->isTranslatorDisabled()) {
211191
It is also possible to use a translator instead of setting own messages with
212192
`setMessage()`. But doing so, you should keep in mind, that the translator works
213193
also on messages you set your own.
194+
195+
> ### Translation compatibility
196+
>
197+
> In versions 2.0 - 2.1, `Zend\Validator\AbstractValidator` implemented
198+
> `Zend\I18n\Translator\TranslatorAwareInterface` and accepted instances of
199+
> `Zend\I18n\Translator\Translator`. Starting in version 2.2.0, zend-validator
200+
> now defines a translator interface, > `Zend\Validator\Translator\TranslatorInterface`,
201+
> as well as it's own -aware variant, > `Zend\Validator\Translator\TranslatorAwareInterface`.
202+
> This was done to reduce dependencies for the component, and follows the
203+
> principal of Separated Interfaces.
204+
>
205+
> The upshot is that if you are migrating from a pre-2.2 version, and receiving
206+
> errors indicating that the translator provided does not implement
207+
> `Zend\Validator\Translator\TranslatorInterface`, you will need to make a
208+
> change to your code.
209+
>
210+
> An implementation of `Zend\Validator\Translator\TranslatorInterface` is
211+
> provided in `Zend\Mvc\I18n\Translator`, which also extends
212+
> `Zend\I18n\Translator\Translator`. This version can be instantiated and used
213+
> just as the original `Zend\I18n` version.
214+
>
215+
> A new service has also been registered with the MVC, `MvcTranslator`, which
216+
> will return this specialized, bridge instance.
217+
>
218+
> Most users should see no issues, as `Zend\Validator\ValidatorPluginManager`
219+
> has been modified to use the `MvcTranslator` service internally, which is how
220+
> most developers were getting the translator instance into validators in the
221+
> first place. You will only need to change code if you were manually injecting
222+
> the instance previously.

doc/book/validator-chains.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Validator Chains
22

3+
## Basic Usage
4+
5+
> ### Installation requirements
6+
>
7+
> The validator chain depends on the zend-servicemanager component, so be sure
8+
> to have it installed before getting started:
9+
>
10+
> ```bash
11+
> $ composer require zendframework/zend-servicemanager
12+
> ```
13+
314
Often, multiple validations should be applied to some value in a particular
415
order. The following code demonstrates a way to solve the example from the
516
[introduction](intro.md), where a username must be between 6 and 12 alphanumeric

doc/book/validators/db.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ given value.
1111
> getting started:
1212
>
1313
> ```bash
14-
> $ composer require zendframework/zend-db`
14+
> $ composer require zendframework/zend-db
1515
> ```
1616
1717
## Supported options

doc/book/validators/digits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
> have it installed before getting started:
99
>
1010
> ```bash
11-
> $ composer require zendframework/zend-filter`
11+
> $ composer require zendframework/zend-filter
1212
> ```
1313
1414
## Supported options

doc/book/validators/sitemap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internally.
5353
> have it installed before getting started:
5454
>
5555
> ```bash
56-
> $ composer require zendframework/zend-uri`
56+
> $ composer require zendframework/zend-uri
5757
> ```
5858
5959
## Priority

0 commit comments

Comments
 (0)