@@ -179,6 +179,22 @@ field is optional but must be a valid email if supplied, you can do the followin
179179
180180..configuration-block ::
181181
182+ ..code-block ::yaml
183+
184+ # src/Acme/BlogBundle/Resources/config/validation.yml
185+ Acme\BlogBundle\Entity\Author :
186+ properties :
187+ profile_data :
188+ -Collection :
189+ fields :
190+ personal_email :
191+ -Collection\Required
192+ -NotBlank :~
193+ -Email :~
194+ alternate_email :
195+ -Collection\Optional :
196+ -Email :~
197+
182198 ..code-block ::php-annotations
183199
184200 // src/Acme/BlogBundle/Entity/Author.php
@@ -200,6 +216,35 @@ field is optional but must be a valid email if supplied, you can do the followin
200216 'personal_email',
201217 );
202218 }
219+
220+ ..code-block ::xml
221+
222+ <!-- src/Acme/BlogBundle/Resources/config/validation.xml-->
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 =" profile_data" >
230+ <constraint name =" Collection" >
231+ <option name =" fields" >
232+ <value key =" personal_email" >
233+ <constraint name =" Collection\Required" >
234+ <constraint name =" NotBlank" />
235+ <constraint name =" Email" />
236+ </constraint >
237+ </value >
238+ <value key =" alternate_email" >
239+ <constraint name =" Collection\Optional" >
240+ <constraint name =" Email" />
241+ </constraint >
242+ </value >
243+ </option >
244+ </constraint >
245+ </property >
246+ </class >
247+ </constraint-mapping >
203248
204249 ..code-block ::php
205250