File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,14 @@ prefixed classes included in doc block comments (``/** ... */``). For example::
106
106
}
107
107
108
108
To enable the annotation loader, call the
109
- :method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::enableAnnotationMapping `
110
- method. It takes an optional annotation reader instance, which defaults to
111
- ``Doctrine\Common\Annotations\AnnotationReader ``::
109
+ :method: `Symfony\\ Component\\ Validator\\ ValidatorBuilder::enableAnnotationMapping ` method.
110
+ ``addDefaultDoctrineAnnotationReader `` must also be called to use ``Doctrine\Common\Annotations\AnnotationReader ``::
112
111
113
112
use Symfony\Component\Validator\Validation;
114
113
115
114
$validator = Validation::createValidatorBuilder()
116
- ->enableAnnotationMapping()
115
+ ->enableAnnotationMapping(true)
116
+ ->addDefaultDoctrineAnnotationReader()
117
117
->getValidator();
118
118
119
119
To disable the annotation loader after it was enabled, call
@@ -134,7 +134,8 @@ multiple mappings::
134
134
use Symfony\Component\Validator\Validation;
135
135
136
136
$validator = Validation::createValidatorBuilder()
137
- ->enableAnnotationMapping()
137
+ ->enableAnnotationMapping(true)
138
+ ->addDefaultDoctrineAnnotationReader()
138
139
->addMethodMapping('loadValidatorMetadata')
139
140
->addXmlMapping('validator/validation.xml')
140
141
->getValidator();
Original file line number Diff line number Diff line change @@ -219,7 +219,8 @@ allows you to return a list of extensions to register::
219
219
220
220
// or if you also need to read constraints from annotations
221
221
$validator = Validation::createValidatorBuilder()
222
- ->enableAnnotationMapping()
222
+ ->enableAnnotationMapping(true)
223
+ ->addDefaultDoctrineAnnotationReader()
223
224
->getValidator();
224
225
225
226
return [
You can’t perform that action at this time.
0 commit comments