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'), + ))); } }