@@ -14,8 +14,8 @@ Creating the Constraint Class
1414
1515First you need to create a Constraint class and extend :class: `Symfony\\ Component\\ Validator\\ Constraint `::
1616
17- // src/Validator/Constraints/ ContainsAlphanumeric.php
18- namespace App\Validator\Constraints ;
17+ // src/Validator/ContainsAlphanumeric.php
18+ namespace App\Validator;
1919
2020 use Symfony\Component\Validator\Constraint;
2121
@@ -54,8 +54,8 @@ when actually performing the validation.
5454
5555The validator class only has one required method ``validate() ``::
5656
57- // src/Validator/Constraints/ ContainsAlphanumericValidator.php
58- namespace App\Validator\Constraints ;
57+ // src/Validator/ContainsAlphanumericValidator.php
58+ namespace App\Validator;
5959
6060 use Symfony\Component\Validator\Constraint;
6161 use Symfony\Component\Validator\ConstraintValidator;
@@ -71,7 +71,7 @@ The validator class only has one required method ``validate()``::
7171 }
7272
7373 // custom constraints should ignore null and empty values to allow
74- // other constraints (NotBlank, NotNull, etc.) take care of that
74+ // other constraints (NotBlank, NotNull, etc.) to take care of that
7575 if (null === $value || '' === $value) {
7676 return;
7777 }
@@ -112,7 +112,7 @@ You can use custom validators like the ones provided by Symfony itself:
112112 // src/Entity/AcmeEntity.php
113113 namespace App\Entity;
114114
115- use App\Validator\Constraints as AcmeAssert;
115+ use App\Validator as AcmeAssert;
116116 use Symfony\Component\Validator\Constraints as Assert;
117117
118118 class AcmeEntity
@@ -135,7 +135,7 @@ You can use custom validators like the ones provided by Symfony itself:
135135 properties :
136136 name :
137137 - NotBlank : ~
138- - App\Validator\Constraints\ ContainsAlphanumeric : ~
138+ - App\Validator\ContainsAlphanumeric : ~
139139
140140 .. code-block :: xml
141141
@@ -148,7 +148,7 @@ You can use custom validators like the ones provided by Symfony itself:
148148 <class name =" App\Entity\AcmeEntity" >
149149 <property name =" name" >
150150 <constraint name =" NotBlank" />
151- <constraint name =" App\Validator\Constraints\ ContainsAlphanumeric" />
151+ <constraint name =" App\Validator\ContainsAlphanumeric" />
152152 </property >
153153 </class >
154154 </constraint-mapping >
@@ -158,7 +158,7 @@ You can use custom validators like the ones provided by Symfony itself:
158158 // src/Entity/AcmeEntity.php
159159 namespace App\Entity;
160160
161- use App\Validator\Constraints\ ContainsAlphanumeric;
161+ use App\Validator\ContainsAlphanumeric;
162162 use Symfony\Component\Validator\Constraints\NotBlank;
163163 use Symfony\Component\Validator\Mapping\ClassMetadata;
164164
@@ -246,21 +246,21 @@ not to the property:
246246 # config/validator/validation.yaml
247247 App\Entity\AcmeEntity :
248248 constraints :
249- - App\Validator\Constraints\ ProtocolClass : ~
249+ - App\Validator\ProtocolClass : ~
250250
251251 .. code-block :: xml
252252
253253 <!-- config/validator/validation.xml -->
254254 <class name =" App\Entity\AcmeEntity" >
255- <constraint name =" App\Validator\Constraints\ ProtocolClass" />
255+ <constraint name =" App\Validator\ProtocolClass" />
256256 </class >
257257
258258 .. code-block :: php
259259
260260 // src/Entity/AcmeEntity.php
261261 namespace App\Entity;
262262
263- use App\Validator\Constraints\ ProtocolClass;
263+ use App\Validator\ProtocolClass;
264264 use Symfony\Component\Validator\Mapping\ClassMetadata;
265265
266266 class AcmeEntity
0 commit comments