From 4ef9034cd1a1a5ff1b084b8da8eca7f7cb11b7b5 Mon Sep 17 00:00:00 2001 From: Sarah KHALIL Date: Fri, 12 Dec 2014 00:19:14 +0100 Subject: [PATCH] [Validator] Updated documentation of URL validator Updated the documentation regarding the Pull Request on Symfony : https://github.com/symfony/symfony/pull/12956 --- reference/constraints/Url.rst | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 42ea1f1da2c..bacec609d33 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -8,6 +8,7 @@ Validates that a value is a valid URL string. +----------------+---------------------------------------------------------------------+ | Options | - `message`_ | | | - `protocols`_ | +| | _ `checkDNS`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Url` | +----------------+---------------------------------------------------------------------+ @@ -26,6 +27,9 @@ Basic Usage properties: bioUrl: - Url: ~ + message: The url "{{ value }}" is not a valid url. + protocols: [http, https] + checkDNS: true .. code-block:: php-annotations @@ -37,7 +41,11 @@ Basic Usage class Author { /** - * @Assert\Url() + * @Assert\Url( + * message = "The url '{{ value }}' is not a valid url", + * protocols = {"http", "https"} + * checkDNS = true + * ) */ protected $bioUrl; } @@ -52,7 +60,14 @@ Basic Usage - + + + + + @@ -69,7 +84,11 @@ 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'), + 'checkDNS' => true, + ))); } } @@ -91,3 +110,11 @@ protocols The protocols that will be considered to be valid. For example, if you also needed ``ftp://`` type URLs to be valid, you'd redefine the ``protocols`` array, listing ``http``, ``https``, and also ``ftp``. + +checkDNS +~~~~~~~~ + +**type**: ``Boolean`` **default**: ``false`` + +If true, then the :phpfunction:`checkdnsrr` PHP function will be used to check +the validity of ANY record of the host of the given url. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy