Skip to content

Commit eb0c8a4

Browse files
committed
Calling enableAnnotationMapping without argument is deprecated
First argument must be set to true.
1 parent a24fc59 commit eb0c8a4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

components/validator/resources.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ prefixed classes included in doc block comments (``/** ... */``). For example::
106106
}
107107

108108
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``::
112111

113112
use Symfony\Component\Validator\Validation;
114113

115114
$validator = Validation::createValidatorBuilder()
116-
->enableAnnotationMapping()
115+
->enableAnnotationMapping(true)
116+
->addDefaultDoctrineAnnotationReader()
117117
->getValidator();
118118

119119
To disable the annotation loader after it was enabled, call
@@ -134,7 +134,8 @@ multiple mappings::
134134
use Symfony\Component\Validator\Validation;
135135

136136
$validator = Validation::createValidatorBuilder()
137-
->enableAnnotationMapping()
137+
->enableAnnotationMapping(true)
138+
->addDefaultDoctrineAnnotationReader()
138139
->addMethodMapping('loadValidatorMetadata')
139140
->addXmlMapping('validator/validation.xml')
140141
->getValidator();

form/unit_testing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ allows you to return a list of extensions to register::
219219

220220
// or if you also need to read constraints from annotations
221221
$validator = Validation::createValidatorBuilder()
222-
->enableAnnotationMapping()
222+
->enableAnnotationMapping(true)
223+
->addDefaultDoctrineAnnotationReader()
223224
->getValidator();
224225

225226
return [

0 commit comments

Comments
 (0)