Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf65a90

Browse filesBrowse files
committed
[Validator] added alpha3 option to country constraint
1 parent 111ae11 commit bf65a90
Copy full SHA for bf65a90

File tree

1 file changed

+12
-0
lines changed
Filter options

1 file changed

+12
-0
lines changed

‎reference/constraints/Country.rst

Copy file name to clipboardExpand all lines: reference/constraints/Country.rst
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Validates that a value is a valid `ISO 3166-1 alpha-2`_ country code.
77
Applies to :ref:`property or method <validation-property-target>`
88
Options - `groups`_
99
- `message`_
10+
- `alpha3`_
1011
- `payload`_
1112
Class :class:`Symfony\\Component\\Validator\\Constraints\\Country`
1213
Validator :class:`Symfony\\Component\\Validator\\Constraints\\CountryValidator`
@@ -78,6 +79,15 @@ Options
7879

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

82+
alpha3
83+
~~~~~~
84+
85+
**type**: ``boolean`` **default**: ``false``
86+
87+
If this option is ``true``, then the constraint will valid the value as
88+
`ISO 3166-1 alpha-3`_ three-letter codes (e.g. France = ``FRA``) instead
89+
of the default `ISO 3166-1 alpha-2`_ two-letter codes (e.g. France = ``FR``).
90+
8191
message
8292
~~~~~~~
8393

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

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.