Skip to content

Documented the checkDNS option of the Url validator #5426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed some errors and made some simplifications
  • Loading branch information
javiereguiluz committed Jun 26, 2015
commit a04b4acadf6822248677378c5cd4e309177a50bd
21 changes: 4 additions & 17 deletions reference/constraints/Url.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This message is shown if the URL is invalid.
Acme\BlogBundle\Entity\Author:
properties:
bioUrl:
- Url: ~
- Url:
message: The url "{{ value }}" is not a valid url.

.. code-block:: xml
Expand Down Expand Up @@ -182,8 +182,7 @@ the ``ftp://`` type URLs to be valid, redefine the ``protocols`` array, listing
Acme\BlogBundle\Entity\Author:
properties:
bioUrl:
- Url: ~
protocols: [http, https, ftp]
- Url: { protocols: [http, https, ftp] }

.. code-block:: xml

Expand Down Expand Up @@ -248,8 +247,6 @@ option to ``true``:
{
/**
* @Assert\Url(
* message = "The url '{{ value }}' is not a valid url",
* protocols = {"http", "https"}
* checkDNS = true
* )
*/
Expand All @@ -262,10 +259,7 @@ option to ``true``:
Acme\BlogBundle\Entity\Author:
properties:
bioUrl:
- Url: ~
message: The url "{{ value }}" is not a valid url.
protocols: [http, https]
checkDNS: true
- Url: { checkDNS: true }

.. code-block:: xml

Expand All @@ -278,11 +272,6 @@ option to ``true``:
<class name="Acme\BlogBundle\Entity\Author">
<property name="bioUrl">
<constraint name="Url">
<option name="message">The url "{{ value }}" is not a valid url.</option>
<option name="protocols">
<value>http</value>
<value>https</value>
</option>
<option name="checkDNS">true</option>
</constraint>
</property>
Expand All @@ -302,9 +291,7 @@ option to ``true``:
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('bioUrl', new Assert\Url(array(
'message' => 'The url "{{ value }}" is not a valid url.',
'protocols' => array('http', 'https'),
'checkDNS' => true,
'checkDNS' => true,
)));
}
}
Expand Down