Skip to content

Commit ed19fbf

Browse files
committed
Tweaks
1 parent c8348c7 commit ed19fbf

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

validation/sequence_provider.rst

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -347,33 +347,28 @@ provides a sequence of groups to be validated:
347347
Advanced Validation Group Provider
348348
----------------------------------
349349

350-
In the previous section, you learned how to dynamically determine the
351-
sequence of groups to apply based on the state of your entity. This
352-
approach covers most common scenarios, but for more advanced needs, you
353-
may find it to be insufficient.
350+
In the previous section, you learned how to change the sequence of groups
351+
dynamically based on the state of your entity. However, in more advanced cases
352+
you might need to use some external configuration or service to define that
353+
sequence of groups.
354354

355-
For instance, suppose you need to provide the sequence of groups from an
356-
external configuration or service that can change its value dynamically.
357355
Managing the entity initialization and manually setting its dependencies can
358356
be cumbersome, and the implementation might not align with the entity
359-
responsibilities.
360-
361-
To address this, you can now configure the implementation of the
362-
:class:`Symfony\\Component\\Validator\\GroupProviderInterface`
363-
outside of the entity, and even register the group provider as a
364-
service if necessary.
357+
responsibilities. To solve this, you can configure the implementation of the
358+
:class:`Symfony\\Component\\Validator\\GroupProviderInterface` outside of the
359+
entity, and even register the group provider as a service.
365360

366361
Here's how you can achieve this:
367362

368-
1) **Define a Separate Group Provider Class:** You can create a class that
369-
implements the :class:`Symfony\\Component\\Validator\\GroupProviderInterface`
370-
and handles the dynamic group sequence logic.
371-
2) **Configure the User with the Provider:** Use the ``provider`` option within the
372-
:class:`Symfony\\Component\\Validator\\Constraints\\GroupSequenceProvider`
373-
attribute to link the entity with the provider class.
374-
3) **Autowiring or Manual Tagging:** If autowiring is enabled, your custom provider
375-
will be automatically linked. Otherwise, you can manually tag your service with
376-
``validator.group_provider``.
363+
1) **Define a Separate Group Provider Class:** create a class that implements
364+
the :class:`Symfony\\Component\\Validator\\GroupProviderInterface`
365+
and handles the dynamic group sequence logic;
366+
2) **Configure the User with the Provider:** use the ``provider`` option within
367+
the :class:`Symfony\\Component\\Validator\\Constraints\\GroupSequenceProvider`
368+
attribute to link the entity with the provider class;
369+
3) **Autowiring or Manual Tagging:** if :doc:` autowiring </service_container/autowiring>`
370+
is enabled, your custom provider will be automatically linked. Otherwise, you must
371+
:doc:`tag your service </service_container/tags>` manually with the ``validator.group_provider`` tag.
377372

378373
.. configuration-block::
379374

0 commit comments

Comments
 (0)