From 4c2abe73577d601381acc4f503812ee99473184a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2013 10:20:02 +0200 Subject: [PATCH] add YAML and XML example for Required and Optional field constraints in a Collection constraint --- reference/constraints/Collection.rst | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 4e709f1d9c0..1dde4458f85 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -179,6 +179,22 @@ field is optional but must be a valid email if supplied, you can do the followin .. configuration-block:: + .. code-block:: yaml + + # src/Acme/BlogBundle/Resources/config/validation.yml + Acme\BlogBundle\Entity\Author: + properties: + profile_data: + - Collection: + fields: + personal_email: + - Collection\Required + - NotBlank: ~ + - Email: ~ + alternate_email: + - Collection\Optional: + - Email: ~ + .. code-block:: php-annotations // 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 'personal_email', ); } + + .. code-block:: xml + + + + + + + + + + + + + .. code-block:: php