Skip to content

Commit 6ad18f2

Browse files
Add GroupSequence validation_groups capability doc
1 parent c347444 commit 6ad18f2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

validation/sequence_provider.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,24 @@ that group are valid, the second group, ``Strict``, will be validated.
140140
sequence, which will contain the ``Default`` group which references the
141141
same group sequence, ...).
142142

143+
You can also define a group sequence in the `validation_groups` form option:
144+
145+
.. code-block:: php
146+
use Symfony\Component\Validator\Constraints\GroupSequence;
147+
use Symfony\Component\Form\AbstractType;
148+
// ...
149+
150+
class MyType extends AbstractType
151+
{
152+
// ...
153+
public function configureOptions(OptionsResolver $resolver)
154+
{
155+
$resolver->setDefaults([
156+
'validation_groups' => new GroupSequence(['First', 'Second']),
157+
]);
158+
}
159+
}
160+
143161
Group Sequence Providers
144162
------------------------
145163

0 commit comments

Comments
 (0)