@@ -86,7 +86,14 @@ configure the locations of these files::
8686The AnnotationLoader
8787--------------------
8888
89- At last, the component provides an
89+ ..deprecated ::6.4
90+
91+ The:class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ AnnotationLoader `
92+ is deprecated since Symfony 6.4, use the
93+ :class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ AttributeLoader `
94+ instead.
95+
96+ The component provides an
9097:class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ AnnotationLoader ` to get
9198the metadata from the annotations of the class. Annotations are defined as ``@ ``
9299prefixed classes included in doc block comments (``/** ... */ ``). For example::
@@ -117,8 +124,44 @@ If you use annotations instead of attributes, it's also required to call
117124To disable the annotation loader after it was enabled, call
118125:method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::disableAnnotationMapping `.
119126
127+ ..deprecated ::6.4
128+
129+ The:method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::enableAnnotationMapping `
130+ and:method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::disableAnnotationMapping `
131+ methods are deprecated since Symfony 6.4, use the
132+ :method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::enableAttributeMapping `
133+ and:method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::disableAttributeMapping `
134+ methods instead.
135+
120136..include ::/_includes/_annotation_loader_tip.rst.inc
121137
138+ The AttributeLoader
139+ -------------------
140+
141+ ..versionadded ::6.4
142+
143+ The:class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ AttributeLoader `
144+ was introduced in Symfony 6.4.
145+
146+ The component provides an
147+ :class: `Symfony\\ Component\\ Validator\\ Mapping\\ Loader\\ AttributeLoader ` to get
148+ the metadata from the attributes of the class. For example::
149+
150+ use Symfony\Component\Validator\Constraints as Assert;
151+ // ...
152+
153+ class User
154+ {
155+ #[Assert\NotBlank]
156+ protected string $name;
157+ }
158+
159+ To enable the attribute loader, call the
160+ :method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::enableAttributeMapping ` method.
161+
162+ To disable the annotation loader after it was enabled, call
163+ :method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::disableAttributeMapping `.
164+
122165Using Multiple Loaders
123166----------------------
124167
@@ -132,8 +175,7 @@ multiple mappings::
132175 use Symfony\Component\Validator\Validation;
133176
134177 $validator = Validation::createValidatorBuilder()
135- ->enableAnnotationMapping(true)
136- ->addDefaultDoctrineAnnotationReader()
178+ ->enableAttributeMapping()
137179 ->addMethodMapping('loadValidatorMetadata')
138180 ->addXmlMapping('validator/validation.xml')
139181 ->getValidator();