@@ -64,17 +64,23 @@ If your valid choice list is simple, you can pass them in directly via the
64
64
.. code-block :: xml
65
65
66
66
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
67
- <class name =" Acme\BlogBundle\Entity\Author" >
68
- <property name =" gender" >
69
- <constraint name =" Choice" >
70
- <option name =" choices" >
71
- <value >male</value >
72
- <value >female</value >
73
- </option >
74
- <option name =" message" >Choose a valid gender.</option >
75
- </constraint >
76
- </property >
77
- </class >
67
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
68
+ <constraint-mapping xmlns =" http://symfony.com/schema/dic/constraint-mapping"
69
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
70
+ xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
71
+
72
+ <class name =" Acme\BlogBundle\Entity\Author" >
73
+ <property name =" gender" >
74
+ <constraint name =" Choice" >
75
+ <option name =" choices" >
76
+ <value >male</value >
77
+ <value >female</value >
78
+ </option >
79
+ <option name =" message" >Choose a valid gender.</option >
80
+ </constraint >
81
+ </property >
82
+ </class >
83
+ </constraint-mapping >
78
84
79
85
.. code-block :: php
80
86
@@ -149,13 +155,19 @@ constraint.
149
155
.. code-block :: xml
150
156
151
157
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
152
- <class name =" Acme\BlogBundle\Entity\Author" >
153
- <property name =" gender" >
154
- <constraint name =" Choice" >
155
- <option name =" callback" >getGenders</option >
156
- </constraint >
157
- </property >
158
- </class >
158
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
159
+ <constraint-mapping xmlns =" http://symfony.com/schema/dic/constraint-mapping"
160
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
161
+ xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
162
+
163
+ <class name =" Acme\BlogBundle\Entity\Author" >
164
+ <property name =" gender" >
165
+ <constraint name =" Choice" >
166
+ <option name =" callback" >getGenders</option >
167
+ </constraint >
168
+ </property >
169
+ </class >
170
+ </constraint-mapping >
159
171
160
172
.. code-block :: php
161
173
@@ -208,16 +220,22 @@ you can pass the class name and the method as an array.
208
220
.. code-block :: xml
209
221
210
222
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
211
- <class name =" Acme\BlogBundle\Entity\Author" >
212
- <property name =" gender" >
213
- <constraint name =" Choice" >
214
- <option name =" callback" >
215
- <value >Util</value >
216
- <value >getGenders</value >
217
- </option >
218
- </constraint >
219
- </property >
220
- </class >
223
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
224
+ <constraint-mapping xmlns =" http://symfony.com/schema/dic/constraint-mapping"
225
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
226
+ xsi : schemaLocation =" http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd" >
227
+
228
+ <class name =" Acme\BlogBundle\Entity\Author" >
229
+ <property name =" gender" >
230
+ <constraint name =" Choice" >
231
+ <option name =" callback" >
232
+ <value >Util</value >
233
+ <value >getGenders</value >
234
+ </option >
235
+ </constraint >
236
+ </property >
237
+ </class >
238
+ </constraint-mapping >
221
239
222
240
.. code-block :: php
223
241
0 commit comments