@@ -125,15 +125,15 @@ that a date must be today or in the past like this:
125125 /**
126126 * @Assert\LessThanOrEqual("today")
127127 */
128- protected $age ;
128+ protected $dateOfBirth ;
129129 }
130130
131131 .. code-block :: yaml
132132
133133 # src/AppBundle/Resources/config/validation.yml
134134 AppBundle\Entity\Person :
135135 properties :
136- age :
136+ dateOfBirth :
137137 - LessThanOrEqual : today
138138
139139 .. code-block :: xml
@@ -145,7 +145,7 @@ that a date must be today or in the past like this:
145145 xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
146146
147147 <class name =" AppBundle\Entity\Person" >
148- <property name =" age " >
148+ <property name =" dateOfBirth " >
149149 <constraint name =" LessThanOrEqual" >today</constraint >
150150 </property >
151151 </class >
@@ -163,7 +163,7 @@ that a date must be today or in the past like this:
163163 {
164164 public static function loadValidatorMetadata(ClassMetadata $metadata)
165165 {
166- $metadata->addPropertyConstraint('age ', new Assert\LessThanOrEqual('today'));
166+ $metadata->addPropertyConstraint('dateOfBirth ', new Assert\LessThanOrEqual('today'));
167167 }
168168 }
169169
@@ -184,15 +184,15 @@ dates. If you want to fix the timezone, append it to the date string:
184184 /**
185185 * @Assert\LessThanOrEqual("today UTC")
186186 */
187- protected $age ;
187+ protected $dateOfBirth ;
188188 }
189189
190190 .. code-block :: yaml
191191
192192 # src/AppBundle/Resources/config/validation.yml
193193 AppBundle\Entity\Person :
194194 properties :
195- age :
195+ dateOfBirth :
196196 - LessThanOrEqual : today UTC
197197
198198 .. code-block :: xml
@@ -204,7 +204,7 @@ dates. If you want to fix the timezone, append it to the date string:
204204 xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
205205
206206 <class name =" AppBundle\Entity\Person" >
207- <property name =" age " >
207+ <property name =" dateOfBirth " >
208208 <constraint name =" LessThanOrEqual" >today UTC</constraint >
209209 </property >
210210 </class >
@@ -222,7 +222,7 @@ dates. If you want to fix the timezone, append it to the date string:
222222 {
223223 public static function loadValidatorMetadata(ClassMetadata $metadata)
224224 {
225- $metadata->addPropertyConstraint('age ', new Assert\LessThanOrEqual('today UTC'));
225+ $metadata->addPropertyConstraint('dateOfBirth ', new Assert\LessThanOrEqual('today UTC'));
226226 }
227227 }
228228
@@ -243,15 +243,15 @@ can check that a person must be at least 18 years old like this:
243243 /**
244244 * @Assert\LessThanOrEqual("-18 years")
245245 */
246- protected $age ;
246+ protected $dateOfBirth ;
247247 }
248248
249249 .. code-block :: yaml
250250
251251 # src/AppBundle/Resources/config/validation.yml
252252 AppBundle\Entity\Person :
253253 properties :
254- age :
254+ dateOfBirth :
255255 - LessThanOrEqual : -18 years
256256
257257 .. code-block :: xml
@@ -263,7 +263,7 @@ can check that a person must be at least 18 years old like this:
263263 xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
264264
265265 <class name =" AppBundle\Entity\Person" >
266- <property name =" age " >
266+ <property name =" dateOfBirth " >
267267 <constraint name =" LessThanOrEqual" >-18 years</constraint >
268268 </property >
269269 </class >
@@ -281,7 +281,7 @@ can check that a person must be at least 18 years old like this:
281281 {
282282 public static function loadValidatorMetadata(ClassMetadata $metadata)
283283 {
284- $metadata->addPropertyConstraint('age ', new Assert\LessThanOrEqual('-18 years'));
284+ $metadata->addPropertyConstraint('dateOfBirth ', new Assert\LessThanOrEqual('-18 years'));
285285 }
286286 }
287287
0 commit comments