Skip to content

[Validator] added alpha3 option to country constraint #12857

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
Changes from all commits
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
12 changes: 12 additions & 0 deletions reference/constraints/Country.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Validates that a value is a valid `ISO 3166-1 alpha-2`_ country code.
Applies to :ref:`property or method <validation-property-target>`
Options - `groups`_
- `message`_
- `alpha3`_
Copy link
Contributor

Choose a reason for hiding this comment

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

We should keep an alpha order here

- `payload`_
Class :class:`Symfony\\Component\\Validator\\Constraints\\Country`
Validator :class:`Symfony\\Component\\Validator\\Constraints\\CountryValidator`
Expand Down Expand Up @@ -78,6 +79,15 @@ Options

.. include:: /reference/constraints/_groups-option.rst.inc

alpha3
~~~~~~

**type**: ``boolean`` **default**: ``false``

If this option is ``true``, then the constraint will valid the value as
`ISO 3166-1 alpha-3`_ three-letter codes (e.g. France = ``FRA``) instead
of the default `ISO 3166-1 alpha-2`_ two-letter codes (e.g. France = ``FR``).

``message``
~~~~~~~~~~~

Expand All @@ -96,3 +106,5 @@ Parameter Description
.. include:: /reference/constraints/_payload-option.rst.inc

.. _`ISO 3166-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
.. _`ISO 3166-1 alpha-3`: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Current_codes