@@ -7,7 +7,7 @@ Loading Resources
7
7
The Validator uses metadata to validate a value. This metadata defines how a
8
8
class, array or any other value should be validated. When validating a class,
9
9
each class contains its own specific metadata. When validating another value,
10
- the metadata to passed to the validate methods.
10
+ the metadata must be passed to the validate methods.
11
11
12
12
Class metadata should be defined somewhere in a configuration file, or in the
13
13
class itself. The ``Validator `` needs to be able to retrieve this metadata
@@ -20,7 +20,7 @@ from the file or class. To do that, it uses a set of loaders.
20
20
The StaticMethodLoader
21
21
----------------------
22
22
23
- The easiest loader is the
23
+ The most basic loader is the
24
24
:class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ StaticMethodLoader `.
25
25
This loader will call a static method of the class in order to get the
26
26
metadata for that class. The name of the method is configured using the
@@ -34,7 +34,7 @@ method of the Validator builder::
34
34
->getValidator();
35
35
36
36
Now, the retrieved ``Validator `` tries to find the ``loadValidatorMetadata() ``
37
- method of the validated class to load its metadata.
37
+ method of the class to validate to load its metadata.
38
38
39
39
.. tip ::
40
40
@@ -70,8 +70,9 @@ The AnnotationLoader
70
70
71
71
At last, the component provides an
72
72
:class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ AnnotationLoader `.
73
- This loader will parse the annotations of a class. Annotations are placed in
74
- PHPdoc comments (`/** ... */ `) and start with an ``@ ``. For instance::
73
+ This loader uses an annotation reader to parse the annotations of a class.
74
+ Annotations are placed in doc block comments (`/** ... */ `) and start with an
75
+ ``@ ``. For instance::
75
76
76
77
// ...
77
78
@@ -97,7 +98,7 @@ To disable the annotation loader after it was enabled, call
97
98
.. note ::
98
99
99
100
In order to use the annotation loader, you should have installed the
100
- ``doctrine/annotations `` and ``doctrine/cache `` packages of Packagist.
101
+ ``doctrine/annotations `` and ``doctrine/cache `` packages from Packagist.
101
102
102
103
Using Multiple Loaders
103
104
----------------------
@@ -121,9 +122,9 @@ multiple mappings::
121
122
Caching
122
123
-------
123
124
124
- Using many loaders to load metadata from different places is very easy for the
125
- developer , but it can easily slow down your application since each file needs
126
- to be parsed, validated and converted to a
125
+ Using many loaders to load metadata from different places is very easy when
126
+ creating the metadata , but it can easily slow down your application since each
127
+ file needs to be parsed, validated and converted to a
127
128
:class: `Symfony\\ Component\\ Validator\\ Mapping\\ ClassMetadata ` instance. To
128
129
solve this problems, you can configure a cacher which will be used to cache
129
130
the ``ClassMetadata `` after it was loaded.
@@ -135,10 +136,11 @@ implements :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface
135
136
136
137
.. note ::
137
138
138
- The loader already use a singleton load mechanism. That means that they
139
- will only load and parse a file once and put that in a property, which
140
- will be used on the next time. However, the Validator still needs to
141
- merge all metadata of one class from every loader when it is requested.
139
+ The loaders already use a singleton load mechanism. That means that the
140
+ loaders will only load and parse a file once and put that in a property,
141
+ which will then be used the next time it is asked for metadata. However,
142
+ the Validator still needs to merge all metadata of one class from every
143
+ loader when it is requested.
142
144
143
145
To set a cacher, call the
144
146
:method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::setMetadataCache ` of
@@ -176,5 +178,5 @@ this custom implementation using
176
178
.. caution ::
177
179
178
180
Since you are using a custom metadata factory, you can't configure loaders
179
- and cachers using the helper methods anymore. You now have to inject them
180
- into your custom metadata factory yourself.
181
+ and cachers using the `` add*Mapping() `` methods anymore. You now have to
182
+ inject them into your custom metadata factory yourself.
0 commit comments