From a2b2fdff1bb9461493e4b9146b00fb00da78d8e2 Mon Sep 17 00:00:00 2001 From: Sarah KHALIL Date: Fri, 12 Dec 2014 00:36:24 +0100 Subject: [PATCH] Update Url.rst --- reference/constraints/Url.rst | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 42ea1f1da2c..14e6b41eb31 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -25,7 +25,9 @@ Basic Usage Acme\BlogBundle\Entity\Author: properties: bioUrl: - - Url: ~ + - Url: + message: The url "{{ value }}" is not a valid url. + protocols: [http, https] .. code-block:: php-annotations @@ -37,7 +39,10 @@ Basic Usage class Author { /** - * @Assert\Url() + * @Assert\Url( + * message = "The url '{{ value }}' is not a valid url", + * protocols = {"http", "https"} + * ) */ protected $bioUrl; } @@ -52,7 +57,13 @@ Basic Usage - + + + + @@ -69,7 +80,10 @@ Basic Usage { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('bioUrl', new Assert\Url()); + $metadata->addPropertyConstraint('bioUrl', new Assert\Url(array( + 'message' => 'The url "{{ value }}" is not a valid url.', + 'protocols' => array('http', 'https'), + ))); } }