diff --git a/reference/constraints/All.rst b/reference/constraints/All.rst index 6ace66df389..08c1bca821b 100644 --- a/reference/constraints/All.rst +++ b/reference/constraints/All.rst @@ -8,6 +8,7 @@ you to apply a collection of constraints to each element of the array. | Applies to | :ref:`property or method ` | +----------------+-------------------------------------------------------------------+ | Options | - `constraints`_ | +| | - `groups`_ | | | - `payload`_ | +----------------+-------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\All` | @@ -109,4 +110,6 @@ constraints This required option is the array of validation constraints that you want to apply to each element of the underlying array. +.. include:: /reference/constraints/_groups-option.rst.inc + .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 57c0081b568..bedc3880d57 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -8,7 +8,8 @@ uniquely identify both financial and non-financial institutions. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Bic` | @@ -85,6 +86,8 @@ will contain a Business Identifier Code (BIC). Available Options ----------------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Blank.rst b/reference/constraints/Blank.rst index 2a203ff3bc6..bc2f5f4b8c7 100644 --- a/reference/constraints/Blank.rst +++ b/reference/constraints/Blank.rst @@ -16,7 +16,8 @@ But be careful as ``NotBlank`` is *not* strictly the opposite of ``Blank``. +----------------+---------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Blank` | @@ -89,6 +90,8 @@ of an ``Author`` class were blank, you could do the following: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 71854cee1ee..b814e3deeef 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -21,6 +21,7 @@ can do anything, including creating and assigning validation errors. | Applies to | :ref:`class ` | +----------------+------------------------------------------------------------------------+ | Options | - :ref:`callback ` | +| | - `groups`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Callback` | @@ -275,4 +276,6 @@ Static or closure callbacks receive the validated object as the first argument and the :class:`Symfony\\Component\\Validator\\Context\\ExecutionContextInterface` instance as the second argument. +.. include:: /reference/constraints/_groups-option.rst.inc + .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 3dac6ce956a..f485c5c0f7a 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -8,7 +8,8 @@ a payment through a payment gateway. +----------------+--------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------+ -| Options | - `schemes`_ | +| Options | - `groups`_ | +| | - `schemes`_ | | | - `message`_ | | | - `payload`_ | +----------------+--------------------------------------------------------------------------+ @@ -101,6 +102,8 @@ on an object that will contain a credit card number. Available Options ----------------- +.. include:: /reference/constraints/_groups-option.rst.inc + schemes ~~~~~~~ diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index b69e58db32f..d7689a00779 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -10,6 +10,7 @@ an array of items is one of those valid choices. +----------------+----------------------------------------------------------------------+ | Options | - `choices`_ | | | - `callback`_ | +| | - `groups`_ | | | - `multiple`_ | | | - `min`_ | | | - `max`_ | @@ -300,6 +301,8 @@ This is a callback method that can be used instead of the `choices`_ option to return the choices array. See `Supplying the Choices with a Callback Function`_ for details on its usage. +.. include:: /reference/constraints/_groups-option.rst.inc + multiple ~~~~~~~~ diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index ccb3538c6ff..76ad34ad103 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -14,10 +14,11 @@ and that extra keys are not present. +----------------+--------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------+ -| Options | - `fields`_ | -| | - `allowExtraFields`_ | -| | - `extraFieldsMessage`_ | +| Options | - `allowExtraFields`_ | | | - `allowMissingFields`_ | +| | - `extraFieldsMessage`_ | +| | - `fields`_ | +| | - `groups`_ | | | - `missingFieldsMessage`_ | | | - `payload`_ | +----------------+--------------------------------------------------------------------------+ @@ -289,15 +290,6 @@ the ``NotBlank`` constraint will still be applied (since it is wrapped in Options ------- -fields -~~~~~~ - -**type**: ``array`` [:ref:`default option `] - -This option is required and is an associative array defining all of the -keys in the collection and, for each key, exactly which validator(s) should -be executed against that element of the collection. - allowExtraFields ~~~~~~~~~~~~~~~~ @@ -307,6 +299,16 @@ If this option is set to ``false`` and the underlying collection contains one or more elements that are not included in the `fields`_ option, a validation error will be returned. If set to ``true``, extra fields are ok. +allowMissingFields +~~~~~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: false + +If this option is set to ``false`` and one or more fields from the `fields`_ +option are not present in the underlying collection, a validation error +will be returned. If set to ``true``, it's ok if some fields in the `fields`_ +option are not present in the underlying collection. + extraFieldsMessage ~~~~~~~~~~~~~~~~~~ @@ -323,15 +325,16 @@ You can use the following parameters in this message: | ``{{ field }}`` | The key of the extra field detected | +------------------+------------------------------------------------+ -allowMissingFields -~~~~~~~~~~~~~~~~~~ +fields +~~~~~~ -**type**: ``boolean`` **default**: false +**type**: ``array`` [:ref:`default option `] -If this option is set to ``false`` and one or more fields from the `fields`_ -option are not present in the underlying collection, a validation error -will be returned. If set to ``true``, it's ok if some fields in the `fields`_ -option are not present in the underlying collection. +This option is required and is an associative array defining all of the +keys in the collection and, for each key, exactly which validator(s) should +be executed against that element of the collection. + +.. include:: /reference/constraints/_groups-option.rst.inc missingFieldsMessage ~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/constraints/Count.rst b/reference/constraints/Count.rst index caa9e2a4103..d995c3cde0c 100644 --- a/reference/constraints/Count.rst +++ b/reference/constraints/Count.rst @@ -13,6 +13,7 @@ Countable) element count is *between* some minimum and maximum value. | | - `maxMessage`_ | | | - `exactMessage`_ | | | - `payload`_ | +| | - `groups`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Count` | +----------------+---------------------------------------------------------------------+ @@ -103,6 +104,8 @@ you might add the following: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + min ~~~ diff --git a/reference/constraints/Country.rst b/reference/constraints/Country.rst index 4e90a348910..439ee10d95c 100644 --- a/reference/constraints/Country.rst +++ b/reference/constraints/Country.rst @@ -6,7 +6,8 @@ Validates that a value is a valid `ISO 3166-1 alpha-2`_ country code. +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Country` | @@ -78,6 +79,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Currency.rst b/reference/constraints/Currency.rst index 53f176fa937..008442eaf7b 100644 --- a/reference/constraints/Currency.rst +++ b/reference/constraints/Currency.rst @@ -6,7 +6,8 @@ Validates that a value is a valid `3-letter ISO 4217`_ currency name. +----------------+---------------------------------------------------------------------------+ | Applies to | :ref:`property or method` | +----------------+---------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+---------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Currency` | @@ -81,6 +82,8 @@ a valid currency, you could do the following: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Date.rst b/reference/constraints/Date.rst index 4bdd3ddf542..9161bfbec71 100644 --- a/reference/constraints/Date.rst +++ b/reference/constraints/Date.rst @@ -8,7 +8,8 @@ valid YYYY-MM-DD format. +----------------+--------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+--------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Date` | @@ -80,6 +81,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/DateTime.rst b/reference/constraints/DateTime.rst index bebdad577e5..51e4ada1e29 100644 --- a/reference/constraints/DateTime.rst +++ b/reference/constraints/DateTime.rst @@ -9,6 +9,7 @@ a specific format. | Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `format`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ @@ -89,6 +90,8 @@ format This option allows to validate a custom date format. See :phpmethod:`DateTime::createFromFormat` for formatting options. +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index bf54c0d4563..617e52834bb 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -12,6 +12,7 @@ cast to a string before being validated. | | - `checkMX`_ | | | - `checkHost`_ | | | - `payload`_ | +| | - `groups`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Email` | +----------------+---------------------------------------------------------------------+ @@ -93,6 +94,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + strict ~~~~~~ diff --git a/reference/constraints/EqualTo.rst b/reference/constraints/EqualTo.rst index 4cf098bcb89..cc9cb645397 100644 --- a/reference/constraints/EqualTo.rst +++ b/reference/constraints/EqualTo.rst @@ -14,6 +14,7 @@ To force that a value is *not* equal, see :doc:`/reference/constraints/NotEqualT | Applies to | :ref:`property or method` | +----------------+-----------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -111,6 +112,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Expression.rst b/reference/constraints/Expression.rst index 3f105be7683..a4072ab40c8 100644 --- a/reference/constraints/Expression.rst +++ b/reference/constraints/Expression.rst @@ -10,6 +10,7 @@ gives you similar flexibility. | Applies to | :ref:`class ` or :ref:`property/method ` | +----------------+-----------------------------------------------------------------------------------------------+ | Options | - :ref:`expression ` | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------------------------------+ @@ -245,6 +246,8 @@ in your expression: * ``value``: The value of the property being validated (only available when the constraint is applied directly to a property); +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 8d440e3fed2..dfad0fc0a5b 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -36,6 +36,7 @@ form field. | | - `uploadExtensionErrorMessage`_ | | | - `uploadErrorMessage`_ | | | - `payload`_ | +| | - `groups`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\File` | +----------------+---------------------------------------------------------------------+ @@ -388,5 +389,7 @@ This message has no parameters. .. include:: /reference/constraints/_payload-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + .. _`IANA website`: http://www.iana.org/assignments/media-types/index.html .. _`Wikipedia: Binary prefix`: http://en.wikipedia.org/wiki/Binary_prefix diff --git a/reference/constraints/GreaterThan.rst b/reference/constraints/GreaterThan.rst index b824fb9765c..9f52031c8bd 100644 --- a/reference/constraints/GreaterThan.rst +++ b/reference/constraints/GreaterThan.rst @@ -10,6 +10,7 @@ than another value, see :doc:`/reference/constraints/LessThan`. | Applies to | :ref:`property or method` | +----------------+---------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -292,6 +293,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/GreaterThanOrEqual.rst b/reference/constraints/GreaterThanOrEqual.rst index 09ef19a7fa8..d23f5f4f002 100644 --- a/reference/constraints/GreaterThanOrEqual.rst +++ b/reference/constraints/GreaterThanOrEqual.rst @@ -9,6 +9,7 @@ the options. To force that a value is greater than another value, see | Applies to | :ref:`property or method` | +----------------+----------------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -290,6 +291,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Iban.rst b/reference/constraints/Iban.rst index 6da89b75b09..46ca3d0baa4 100644 --- a/reference/constraints/Iban.rst +++ b/reference/constraints/Iban.rst @@ -9,7 +9,8 @@ borders with a reduced risk of propagating transcription errors. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Iban` | @@ -95,6 +96,8 @@ will contain an International Bank Account Number. Available Options ----------------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/IdenticalTo.rst b/reference/constraints/IdenticalTo.rst index c05d63776c5..83e68f09ba0 100644 --- a/reference/constraints/IdenticalTo.rst +++ b/reference/constraints/IdenticalTo.rst @@ -15,6 +15,7 @@ To force that a value is *not* identical, see | Applies to | :ref:`property or method` | +----------------+--------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -114,6 +115,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 9691f59f19c..88f9e37b982 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -38,6 +38,7 @@ of the documentation on this constraint. | | - `allowPortraitMessage`_ | | | - `corruptedMessage`_ | | | - See :doc:`File ` for inherited options | +| | - `groups`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Image` | +----------------+-----------------------------------------------------------------------+ @@ -581,5 +582,7 @@ is corrupted. This message has no parameters. +.. include:: /reference/constraints/_groups-option.rst.inc + .. _`IANA website`: http://www.iana.org/assignments/media-types/image/index.html .. _`PHP GD extension`: http://php.net/manual/en/book.image.php diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index b7d860a5876..87e5c5f51eb 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -9,6 +9,7 @@ IPv6 and many other combinations. | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `version`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | +----------------+---------------------------------------------------------------------+ @@ -125,6 +126,8 @@ of a variety of different values: ``all_public`` Validates for all IP formats but without private and reserved ranges +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/IsFalse.rst b/reference/constraints/IsFalse.rst index 9562911d2ce..1555742336a 100644 --- a/reference/constraints/IsFalse.rst +++ b/reference/constraints/IsFalse.rst @@ -10,7 +10,8 @@ Also see :doc:`IsTrue `. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\IsFalse` | @@ -105,6 +106,8 @@ method returns **false**: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/IsNull.rst b/reference/constraints/IsNull.rst index 2a01537f0a0..226dd8c0883 100644 --- a/reference/constraints/IsNull.rst +++ b/reference/constraints/IsNull.rst @@ -10,7 +10,8 @@ Also see :doc:`NotNull `. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\IsNull` | @@ -83,6 +84,8 @@ of an ``Author`` class exactly equal to ``null``, you could do the following: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/IsTrue.rst b/reference/constraints/IsTrue.rst index 7f05b98e66d..9e9693a4c37 100644 --- a/reference/constraints/IsTrue.rst +++ b/reference/constraints/IsTrue.rst @@ -10,7 +10,8 @@ Also see :doc:`IsFalse `. +----------------+---------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\IsTrue` | @@ -119,6 +120,8 @@ If the ``isTokenValid()`` returns false, the validation will fail. Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index 293149c45c0..ef06ccb77a2 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -8,6 +8,7 @@ is either a valid ISBN-10 or a valid ISBN-13. | Applies to | :ref:`property or method` | +----------------+----------------------------------------------------------------------+ | Options | - `type`_ | +| | - `groups`_ | | | - `message`_ | | | - `isbn10Message`_ | | | - `isbn13Message`_ | @@ -107,6 +108,8 @@ type The type of ISBN to validate against. Valid values are ``isbn10``, ``isbn13`` and ``null`` to accept any kind of ISBN. +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Issn.rst b/reference/constraints/Issn.rst index af17050a169..9af7f7a0492 100644 --- a/reference/constraints/Issn.rst +++ b/reference/constraints/Issn.rst @@ -7,7 +7,8 @@ Validates that a value is a valid +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `caseSensitive`_ | | | - `requireHyphen`_ | | | - `payload`_ | @@ -81,6 +82,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index 76131e280a1..b6705a704c3 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -7,7 +7,8 @@ Validates that a value is a valid language *Unicode language identifier* +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Language` | @@ -79,6 +80,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index f1877ebf391..a61319bcd32 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -20,6 +20,7 @@ Validates that a given string length is *between* some minimum and maximum value | | - `exactMessage`_ | | | - `charsetMessage`_ | | | - `payload`_ | +| | - `groups`_ | +----------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Length` | +----------------+----------------------------------------------------------------------+ @@ -218,3 +219,5 @@ You can use the following parameters in this message: +-------------------+-----------------------------+ .. include:: /reference/constraints/_payload-option.rst.inc + +.. include:: /reference/constraints/_groups-option.rst.inc diff --git a/reference/constraints/LessThan.rst b/reference/constraints/LessThan.rst index 77787f852d6..fe39d3578d0 100644 --- a/reference/constraints/LessThan.rst +++ b/reference/constraints/LessThan.rst @@ -10,6 +10,7 @@ than another value, see :doc:`/reference/constraints/GreaterThan`. | Applies to | :ref:`property or method` | +----------------+------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -291,6 +292,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/LessThanOrEqual.rst b/reference/constraints/LessThanOrEqual.rst index 28666bcd9d0..0b5557284d9 100644 --- a/reference/constraints/LessThanOrEqual.rst +++ b/reference/constraints/LessThanOrEqual.rst @@ -9,6 +9,7 @@ options. To force that a value is less than another value, see | Applies to | :ref:`property or method` | +----------------+-------------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -289,6 +290,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Locale.rst b/reference/constraints/Locale.rst index 70051d12c3a..2ea02ef1fce 100644 --- a/reference/constraints/Locale.rst +++ b/reference/constraints/Locale.rst @@ -11,7 +11,8 @@ French/France). +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Locale` | @@ -83,6 +84,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Luhn.rst b/reference/constraints/Luhn.rst index a3df0a7304d..ec873f2b278 100644 --- a/reference/constraints/Luhn.rst +++ b/reference/constraints/Luhn.rst @@ -8,7 +8,8 @@ card: before communicating with a payment gateway. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Luhn` | @@ -90,6 +91,8 @@ will contain a credit card number. Available Options ----------------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/NotBlank.rst b/reference/constraints/NotBlank.rst index b49f1df73ea..a7ec531d2c2 100644 --- a/reference/constraints/NotBlank.rst +++ b/reference/constraints/NotBlank.rst @@ -14,7 +14,8 @@ To force that a value is not equal to ``null``, see the +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\NotBlank` | @@ -87,6 +88,8 @@ class were not blank, you could do the following: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/NotEqualTo.rst b/reference/constraints/NotEqualTo.rst index e5ed3fae99d..3ff690b4fab 100644 --- a/reference/constraints/NotEqualTo.rst +++ b/reference/constraints/NotEqualTo.rst @@ -15,6 +15,7 @@ options. To force that a value is equal, see | Applies to | :ref:`property or method` | +----------------+-------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -113,6 +114,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/NotIdenticalTo.rst b/reference/constraints/NotIdenticalTo.rst index 861d01c2b80..a2393dc8639 100644 --- a/reference/constraints/NotIdenticalTo.rst +++ b/reference/constraints/NotIdenticalTo.rst @@ -15,6 +15,7 @@ the options. To force that a value is identical, see | Applies to | :ref:`property or method` | +----------------+-----------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | | | - `propertyPath`_ | @@ -114,6 +115,8 @@ Options .. include:: /reference/constraints/_comparison-value-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/NotNull.rst b/reference/constraints/NotNull.rst index 75d0c0fd9cb..a66653e7a7b 100644 --- a/reference/constraints/NotNull.rst +++ b/reference/constraints/NotNull.rst @@ -8,7 +8,8 @@ constraint. +----------------+-----------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\NotNull` | @@ -81,6 +82,8 @@ class were not strictly equal to ``null``, you would: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Range.rst b/reference/constraints/Range.rst index fa12d20e9d6..fd0745ac95b 100644 --- a/reference/constraints/Range.rst +++ b/reference/constraints/Range.rst @@ -12,6 +12,7 @@ Validates that a given number or ``DateTime`` object is *between* some minimum a | | - `maxMessage`_ | | | - `invalidMessage`_ | | | - `payload`_ | +| | - `groups`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Range` | +----------------+---------------------------------------------------------------------+ @@ -387,5 +388,7 @@ You can use the following parameters in this message: .. include:: /reference/constraints/_payload-option.rst.inc +.. include:: /reference/constraints/_groups-option.rst.inc + .. _`is_numeric`: https://php.net/manual/en/function.is-numeric.php .. _`accepted by the DateTime constructor`: https://php.net/manual/en/datetime.formats.php diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index a8ff93bfe4b..bb0fda4222e 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -7,6 +7,7 @@ Validates that a value matches a regular expression. | Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `pattern`_ | +| | - `groups`_ | | | - `htmlPattern`_ | | | - `match`_ | | | - `message`_ | @@ -177,6 +178,8 @@ does *not* match this regular expression (via the :phpfunction:`preg_match` PHP function). However, if `match`_ is set to false, then validation will fail if the input string *does* match this pattern. +.. include:: /reference/constraints/_groups-option.rst.inc + htmlPattern ~~~~~~~~~~~ diff --git a/reference/constraints/Time.rst b/reference/constraints/Time.rst index 0bb515c50b8..c1a9b7eb6d5 100644 --- a/reference/constraints/Time.rst +++ b/reference/constraints/Time.rst @@ -8,7 +8,8 @@ that follows a valid ``HH:MM:SS`` format. +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Time` | @@ -83,6 +84,8 @@ of the day when the event starts: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 16bc72bcbc8..3ca21f37cd4 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -9,6 +9,7 @@ option to validate this. | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - :ref:`type ` | +| | - `groups`_ | | | - `message`_ | | | - `payload`_ | +----------------+---------------------------------------------------------------------+ @@ -153,6 +154,8 @@ Also, you can use ``ctype_()`` functions from corresponding Make sure that the proper :phpfunction:`locale ` is set before using one of these. +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index c8ee4c44bb2..f1fca2d0206 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -9,6 +9,7 @@ using an email address that already exists in the system. | Applies to | :ref:`class ` | +----------------+-------------------------------------------------------------------------------------+ | Options | - `fields`_ | +| | - `groups`_ | | | - `message`_ | | | - `em`_ | | | - `repositoryMethod`_ | @@ -135,6 +136,8 @@ If you need to require two fields to be individually unique (e.g. a unique ``email`` *and* a unique ``username``), you use two ``UniqueEntity`` entries, each with a single field. +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index b3fecab262f..adf4804d261 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -6,7 +6,8 @@ Validates that a value is a valid URL string. +----------------+---------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `protocols`_ | | | - `payload`_ | | | - `checkDNS`_ | @@ -81,6 +82,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 6140cfdbc91..c473a98504a 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -13,7 +13,8 @@ password, but needs to enter their old password for security. +----------------+--------------------------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `payload`_ | +----------------+--------------------------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword` | @@ -100,6 +101,8 @@ the user's current password: Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Uuid.rst b/reference/constraints/Uuid.rst index 66b40ea3d6f..938eebbe42d 100644 --- a/reference/constraints/Uuid.rst +++ b/reference/constraints/Uuid.rst @@ -9,7 +9,8 @@ UUID versions can also be restricted using a whitelist. +----------------+---------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ -| Options | - `message`_ | +| Options | - `groups`_ | +| | - `message`_ | | | - `strict`_ | | | - `versions`_ | | | - `payload`_ | @@ -83,6 +84,8 @@ Basic Usage Options ------- +.. include:: /reference/constraints/_groups-option.rst.inc + message ~~~~~~~ diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index 72c4fb55792..bbab48a685f 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -10,6 +10,7 @@ an object and all sub-objects associated with it. +----------------+---------------------------------------------------------------------+ | Options | - `traverse`_ | | | - `payload`_ | +| | - `groups`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Valid` | +----------------+---------------------------------------------------------------------+ @@ -266,3 +267,5 @@ then each object in that array will be validated only if this option is set to ``true``. .. include:: /reference/constraints/_payload-option.rst.inc + +.. include:: /reference/constraints/_groups-option.rst.inc diff --git a/reference/constraints/_groups-option.rst.inc b/reference/constraints/_groups-option.rst.inc new file mode 100644 index 00000000000..f385b060477 --- /dev/null +++ b/reference/constraints/_groups-option.rst.inc @@ -0,0 +1,7 @@ +groups +~~~~~~ + +**type**: ``array`` | ``string`` + +It defines the validation group or groups this constraint belongs to. Read more +about :doc:`validation groups `.