8000 Added documentation for dnsMessage option by BenjaminPaap · Pull Request #5804 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added documentation for dnsMessage option #5804

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

Merged
merged 4 commits into from
Nov 5, 2015
Merged
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 all comments from @xabbuh
  • Loading branch information
BenjaminPaap committed Oct 19, 2015
commit bffb90ddffddff44bf5a3bbf7f031b0061f4d1a8
17 changes: 9 additions & 8 deletions reference/constraints/Url.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Validates that a value is a valid URL string.
| | - `protocols`_ |
| | - `payload`_ |
| | - `checkDNS`_ |
| | - `dnsMessage`_
| | - `dnsMessage`_ |
+----------------+---------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Url` |
+----------------+---------------------------------------------------------------------+
Expand Down Expand Up @@ -300,6 +300,9 @@ option to ``true``:
}
}

This option uses the :phpfunction:`checkdnsrr` PHP function to check the validity
of the ``ANY`` DNS record corresponding to the host associated with the given URL.

dnsMessage
~~~~~~~~~~

Expand All @@ -324,7 +327,7 @@ DNS check failed.
{
/**
* @Assert\Url(
* dnsMessage = "The host '{{ value }}' could not be resolved"
* dnsMessage = "The host '{{ value }}' could not be resolved."
* )
*/
protected $bioUrl;
Expand All @@ -336,7 +339,8 @@ DNS check failed.
AppBundle\Entity\Author:
properties:
bioUrl:
- Url: { dnsMessage: The host "{{ value }}" could not be resolved }
- Url:
dnsMessage: 'The host "{{ value }}" could not be resolved.'

.. code-block:: xml

Expand All @@ -349,7 +353,7 @@ DNS check failed.
<class name="AppBundle\Entity\Author">
<property name="bioUrl">
<constraint name="Url">
<option name="dnsMessage">The host "{{ value }}" could not be resolved</option>
<option name="dnsMessage">The host "{{ value }}" could not be resolved.</option>
</constraint>
</property>
</class>
Expand All @@ -368,10 +372,7 @@ DNS check failed.
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('bioUrl', new Assert\Url(array(
'dnsMessage' => 'The host "{{ value }}" could not be resolved'
'dnsMessage' => 'The host "{{ value }}" could not be resolved.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually add a comma after each array entry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. Am I supposed to add one on this pr or just keeping this in mind for upcoming pr's?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to, you can make that change. Otherwise we will just apply this when merging. :)

)));
}
}

This option uses the :phpfunction:`checkdnsrr` PHP function to check the validity
of the ``ANY`` DNS record corresponding to the host associated with the given URL.
0