Skip to content

Commit 2e73849

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: Added the docs for the \"groups\" constraint option fixed paragraph about which versionadded directives will be removed
2 parents 31b9bae + 56e73bb commit 2e73849

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+197
-54
lines changed

contributing/community/review-comments.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ Don't use hyperbole ("always", "never", "endlessly", "nothing", "worst", "horrib
9191
**Don't:** *"I don't like how you wrote this code"* - there is no clear explanation why you
9292
don't like how it's written.
9393

94-
**Better:** *"I find it hard to read this code as there is many nested if statements, can you make it more
95-
readable? By encapsulating some of its details or maybe adding some comments to explain the overall logic."* -
94+
**Better:** *"I find it hard to read this code as there are many nested if statements, can you make it more
95+
readable? By encapsulating some of the details or maybe adding some comments to explain the overall logic."* -
9696
You explain why you find the code hard to read *and* give some suggestions for improvement.
9797

9898
If a piece of code is in fact wrong, explain why:
9999

100100
* "This code doesn't comply with Symfony's CS rules. Please see [...] for details."
101101

102-
* "Symfony 3 still uses PHP 5 and doesn't allow the usage scalar type-hints."
102+
* "Symfony 3 still uses PHP 5 and doesn't allow the usage of scalar type-hints."
103103

104104
* "I think the code is less readable now." - careful here, be sure explain why you think
105105
the code is less readable, and maybe give some suggestions?

contributing/documentation/format.rst

+10-12
Original file line numberDiff line numberDiff line change
@@ -173,32 +173,30 @@ New Features or Behavior Changes
173173

174174
If you're documenting a brand new feature or a change that's been made in
175175
Symfony, you should precede your description of the change with a
176-
``.. versionadded:: 2.X`` directive and a short description:
176+
``.. versionadded:: 3.x`` directive and a short description:
177177

178178
.. code-block:: rst
179179
180-
.. versionadded:: 2.7
180+
.. versionadded:: 3.4
181181
182-
The ``askHiddenResponse()`` method was introduced in Symfony 2.7.
183-
184-
You can also ask a question and hide the response. This is particularly [...]
182+
The special ``!`` template prefix was introduced in Symfony 3.4.
185183
186184
If you're documenting a behavior change, it may be helpful to *briefly* describe
187185
how the behavior has changed:
188186

189187
.. code-block:: rst
190188
191-
.. versionadded:: 2.7
189+
.. versionadded:: 3.4
192190
193-
The ``include()`` function is a new Twig feature that's available in
194-
Symfony 2.7. Prior, the ``{% include %}`` tag was used.
191+
Support for annotation routing without an external bundle was added in
192+
Symfony 3.4. Prior, you needed to install the SensioFrameworkExtraBundle.
195193
196-
Whenever a new minor version of Symfony is released (e.g. 2.4, 2.5, etc),
194+
Whenever a new major version of Symfony is released (e.g. 3.0, 4.0, etc),
197195
a new branch of the documentation is created from the ``master`` branch.
198196
At this point, all the ``versionadded`` tags for Symfony versions that have
199-
reached end-of-maintenance will be removed. For example, if Symfony 2.5 were
200-
released today, and 2.2 had recently reached its end-of-maintenance, the 2.2
201-
``versionadded`` tags would be removed from the new ``2.5`` branch.
197+
a lower major version will be removed. For example, if Symfony 4.0 were
198+
released today, 3.0 to 3.4 ``versionadded`` tags would be removed from the new
199+
``4.0`` branch.
202200

203201
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
204202
.. _Sphinx: http://sphinx-doc.org/

reference/constraints/All.rst

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ you to apply a collection of constraints to each element of the array.
88
| Applies to | :ref:`property or method <validation-property-target>` |
99
+----------------+-------------------------------------------------------------------+
1010
| Options | - `constraints`_ |
11+
| | - `groups`_ |
1112
| | - `payload`_ |
1213
+----------------+-------------------------------------------------------------------+
1314
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\All` |
@@ -109,4 +110,6 @@ constraints
109110
This required option is the array of validation constraints that you want
110111
to apply to each element of the underlying array.
111112

113+
.. include:: /reference/constraints/_groups-option.rst.inc
114+
112115
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Bic.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ check that the BIC is associated with a given IBAN.
99
+----------------+-----------------------------------------------------------------------+
1010
| Applies to | :ref:`property or method <validation-property-target>` |
1111
+----------------+-----------------------------------------------------------------------+
12-
| Options | - `message`_ |
12+
| Options | - `groups`_ |
13+
| | - `message`_ |
1314
| | - `payload`_ |
1415
| | - `iban`_ |
1516
| | - `ibanMessage`_ |
@@ -89,6 +90,8 @@ will contain a Business Identifier Code (BIC).
8990
Available Options
9091
-----------------
9192

93+
.. include:: /reference/constraints/_groups-option.rst.inc
94+
9295
message
9396
~~~~~~~
9497

reference/constraints/Blank.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ But be careful as ``NotBlank`` is *not* strictly the opposite of ``Blank``.
1616
+----------------+---------------------------------------------------------------------+
1717
| Applies to | :ref:`property or method <validation-property-target>` |
1818
+----------------+---------------------------------------------------------------------+
19-
| Options | - `message`_ |
19+
| Options | - `groups`_ |
20+
| | - `message`_ |
2021
| | - `payload`_ |
2122
+----------------+---------------------------------------------------------------------+
2223
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Blank` |
@@ -89,6 +90,8 @@ of an ``Author`` class were blank, you could do the following:
8990
Options
9091
-------
9192

93+
.. include:: /reference/constraints/_groups-option.rst.inc
94+
9295
message
9396
~~~~~~~
9497

reference/constraints/Callback.rst

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ can do anything, including creating and assigning validation errors.
2121
| Applies to | :ref:`class <validation-class-target>` |
2222
+----------------+------------------------------------------------------------------------+
2323
| Options | - :ref:`callback <callback-option>` |
24+
| | - `groups`_ |
2425
| | - `payload`_ |
2526
+----------------+------------------------------------------------------------------------+
2627
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Callback` |
@@ -275,4 +276,6 @@ Static or closure callbacks receive the validated object as the first argument
275276
and the :class:`Symfony\\Component\\Validator\\Context\\ExecutionContextInterface`
276277
instance as the second argument.
277278

279+
.. include:: /reference/constraints/_groups-option.rst.inc
280+
278281
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/CardScheme.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ a payment through a payment gateway.
88
+----------------+--------------------------------------------------------------------------+
99
| Applies to | :ref:`property or method <validation-property-target>` |
1010
+----------------+--------------------------------------------------------------------------+
11-
| Options | - `schemes`_ |
11+
| Options | - `groups`_ |
12+
| | - `schemes`_ |
1213
| | - `message`_ |
1314
| | - `payload`_ |
1415
+----------------+--------------------------------------------------------------------------+
@@ -101,6 +102,8 @@ on an object that will contain a credit card number.
101102
Available Options
102103
-----------------
103104

105+
.. include:: /reference/constraints/_groups-option.rst.inc
106+
104107
schemes
105108
~~~~~~~
106109

reference/constraints/Choice.rst

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ an array of items is one of those valid choices.
1010
+----------------+----------------------------------------------------------------------+
1111
| Options | - `choices`_ |
1212
| | - `callback`_ |
13+
| | - `groups`_ |
1314
| | - `multiple`_ |
1415
| | - `min`_ |
1516
| | - `max`_ |
@@ -295,6 +296,8 @@ This is a callback method that can be used instead of the `choices`_ option
295296
to return the choices array. See
296297
`Supplying the Choices with a Callback Function`_ for details on its usage.
297298

299+
.. include:: /reference/constraints/_groups-option.rst.inc
300+
298301
multiple
299302
~~~~~~~~
300303

reference/constraints/Collection.rst

+22-19
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ and that extra keys are not present.
1414
+----------------+--------------------------------------------------------------------------+
1515
| Applies to | :ref:`property or method <validation-property-target>` |
1616
+----------------+--------------------------------------------------------------------------+
17-
| Options | - `fields`_ |
18-
| | - `allowExtraFields`_ |
19-
| | - `extraFieldsMessage`_ |
17+
| Options | - `allowExtraFields`_ |
2018
| | - `allowMissingFields`_ |
19+
| | - `extraFieldsMessage`_ |
20+
| | - `fields`_ |
21+
| | - `groups`_ |
2122
| | - `missingFieldsMessage`_ |
2223
| | - `payload`_ |
2324
+----------------+--------------------------------------------------------------------------+
@@ -289,15 +290,6 @@ the ``NotBlank`` constraint will still be applied (since it is wrapped in
289290
Options
290291
-------
291292

292-
fields
293-
~~~~~~
294-
295-
**type**: ``array`` [:ref:`default option <validation-default-option>`]
296-
297-
This option is required and is an associative array defining all of the
298-
keys in the collection and, for each key, exactly which validator(s) should
299-
be executed against that element of the collection.
300-
301293
allowExtraFields
302294
~~~~~~~~~~~~~~~~
303295

@@ -307,6 +299,16 @@ If this option is set to ``false`` and the underlying collection contains
307299
one or more elements that are not included in the `fields`_ option, a validation
308300
error will be returned. If set to ``true``, extra fields are ok.
309301

302+
allowMissingFields
303+
~~~~~~~~~~~~~~~~~~
304+
305+
**type**: ``boolean`` **default**: false
306+
307+
If this option is set to ``false`` and one or more fields from the `fields`_
308+
option are not present in the underlying collection, a validation error
309+
will be returned. If set to ``true``, it's ok if some fields in the `fields`_
310+
option are not present in the underlying collection.
311+
310312
extraFieldsMessage
311313
~~~~~~~~~~~~~~~~~~
312314

@@ -323,15 +325,16 @@ You can use the following parameters in this message:
323325
| ``{{ field }}`` | The key of the extra field detected |
324326
+------------------+------------------------------------------------+
325327

326-
allowMissingFields
327-
~~~~~~~~~~~~~~~~~~
328+
fields
329+
~~~~~~
328330

329-
**type**: ``boolean`` **default**: false
331+
**type**: ``array`` [:ref:`default option <validation-default-option>`]
330332

331-
If this option is set to ``false`` and one or more fields from the `fields`_
332-
option are not present in the underlying collection, a validation error
333-
will be returned. If set to ``true``, it's ok if some fields in the `fields`_
334-
option are not present in the underlying collection.
333+
This option is required and is an associative array defining all of the
334+
keys in the collection and, for each key, exactly which validator(s) should
335+
be executed against that element of the collection.
336+
337+
.. include:: /reference/constraints/_groups-option.rst.inc
335338

336339
missingFieldsMessage
337340
~~~~~~~~~~~~~~~~~~~~

reference/constraints/Count.rst

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Countable) element count is *between* some minimum and maximum value.
1313
| | - `maxMessage`_ |
1414
| | - `exactMessage`_ |
1515
| | - `payload`_ |
16+
| | - `groups`_ |
1617
+----------------+---------------------------------------------------------------------+
1718
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Count` |
1819
+----------------+---------------------------------------------------------------------+
@@ -103,6 +104,8 @@ you might add the following:
103104
Options
104105
-------
105106

107+
.. include:: /reference/constraints/_groups-option.rst.inc
108+
106109
min
107110
~~~
108111

reference/constraints/Country.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Validates that a value is a valid `ISO 3166-1 alpha-2`_ country code.
66
+----------------+------------------------------------------------------------------------+
77
| Applies to | :ref:`property or method <validation-property-target>` |
88
+----------------+------------------------------------------------------------------------+
9-
| Options | - `message`_ |
9+
| Options | - `groups`_ |
10+
| | - `message`_ |
1011
| | - `payload`_ |
1112
+----------------+------------------------------------------------------------------------+
1213
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Country` |
@@ -78,6 +79,8 @@ Basic Usage
7879
Options
7980
-------
8081

82+
.. include:: /reference/constraints/_groups-option.rst.inc
83+
8184
message
8285
~~~~~~~
8386

reference/constraints/Currency.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Validates that a value is a valid `3-letter ISO 4217`_ currency name.
66
+----------------+---------------------------------------------------------------------------+
77
| Applies to | :ref:`property or method<validation-property-target>` |
88
+----------------+---------------------------------------------------------------------------+
9-
| Options | - `message`_ |
9+
| Options | - `groups`_ |
10+
| | - `message`_ |
1011
| | - `payload`_ |
1112
+----------------+---------------------------------------------------------------------------+
1213
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Currency` |
@@ -81,6 +82,8 @@ a valid currency, you could do the following:
8182
Options
8283
-------
8384

85+
.. include:: /reference/constraints/_groups-option.rst.inc
86+
8487
message
8588
~~~~~~~
8689

reference/constraints/Date.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ be cast into a string) that follows a valid ``YYYY-MM-DD`` format.
77
+----------------+--------------------------------------------------------------------+
88
| Applies to | :ref:`property or method <validation-property-target>` |
99
+----------------+--------------------------------------------------------------------+
10-
| Options | - `message`_ |
10+
| Options | - `groups`_ |
11+
| | - `message`_ |
1112
| | - `payload`_ |
1213
+----------------+--------------------------------------------------------------------+
1314
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Date` |
@@ -85,6 +86,8 @@ Basic Usage
8586
Options
8687
-------
8788

89+
.. include:: /reference/constraints/_groups-option.rst.inc
90+
8891
message
8992
~~~~~~~
9093

reference/constraints/DateTime.rst

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ that can be cast into a string) that follows a specific format.
88
| Applies to | :ref:`property or method <validation-property-target>` |
99
+----------------+------------------------------------------------------------------------+
1010
| Options | - `format`_ |
11+
| | - `groups`_ |
1112
| | - `message`_ |
1213
| | - `payload`_ |
1314
+----------------+------------------------------------------------------------------------+
@@ -94,6 +95,8 @@ format
9495
This option allows to validate a custom date format. See
9596
:phpmethod:`DateTime::createFromFormat` for formatting options.
9697

98+
.. include:: /reference/constraints/_groups-option.rst.inc
99+
97100
message
98101
~~~~~~~
99102

reference/constraints/Email.rst

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cast to a string before being validated.
1212
| | - `checkMX`_ |
1313
| | - `checkHost`_ |
1414
| | - `payload`_ |
15+
| | - `groups`_ |
1516
+----------------+---------------------------------------------------------------------+
1617
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Email` |
1718
+----------------+---------------------------------------------------------------------+
@@ -93,6 +94,8 @@ Basic Usage
9394
Options
9495
-------
9596

97+
.. include:: /reference/constraints/_groups-option.rst.inc
98+
9699
mode
97100
~~~~
98101

reference/constraints/EqualTo.rst

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ To force that a value is *not* equal, see :doc:`/reference/constraints/NotEqualT
1414
| Applies to | :ref:`property or method<validation-property-target>` |
1515
+----------------+-----------------------------------------------------------------------+
1616
| Options | - `value`_ |
17+
| | - `groups`_ |
1718
| | - `message`_ |
1819
| | - `payload`_ |
1920
| | - `propertyPath`_ |
@@ -111,6 +112,8 @@ Options
111112

112113
.. include:: /reference/constraints/_comparison-value-option.rst.inc
113114

115+
.. include:: /reference/constraints/_groups-option.rst.inc
116+
114117
message
115118
~~~~~~~
116119

0 commit comments

Comments
 (0)