Skip to content

Commit 3d1f59f

Browse files
committed
[#2766] Minor tweaks to group sequence provider, including a few typos and adding the missing interface
1 parent 619bd2c commit 3d1f59f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

book/validation.rst

+14-13
Original file line numberDiff line numberDiff line change
@@ -960,10 +960,11 @@ entity and a new constraint group called ``Premium``:
960960
private $name;
961961
962962
/**
963-
* @Assert\CardScheme(
964-
* schemes={"VISA"},
965-
* groups={"Premium"},
966-
* )
963+
* @Assert\CardScheme(
964+
* schemes={"VISA"},
965+
* groups={"Premium"},
966+
* )
967+
*/
967968
private $creditCard;
968969
}
969970
@@ -1024,14 +1025,14 @@ entity and a new constraint group called ``Premium``:
10241025
}
10251026
}
10261027
1027-
Now, let this class implement
1028-
:class:`Symfony\\Componet\\Validation\\GroupSequenceProviderInterface` and
1029-
implement a method called
1030-
:method:`Symfony\\Componet\\Validation\\GroupSequenceProviderInterface::getGroupSequence`,
1031-
which returns an array of groups to use and add the
1032-
``@Assert\GroupSequencdeProvider`` annotation to the class. Imagine a method
1033-
``isPremium`` returns true if the user is a premium member. Your method looks
1034-
like this::
1028+
Now, change the ``User`` class to implement
1029+
:class:`Symfony\\Component\\Validation\\GroupSequenceProviderInterface` and
1030+
add the
1031+
:method:`Symfony\\Component\\Validation\\GroupSequenceProviderInterface::getGroupSequence`,
1032+
which should return an array of groups to use. Also, add the
1033+
``@Assert\GroupSequenceProvider`` annotation to the class. If you imagine
1034+
that a method called ``isPremium`` returns true if the user is a premium member,
1035+
then your code might look like this::
10351036

10361037
// src/Acme/DemoBundle/Entity/User.php
10371038
namespace Acme\DemoBundle\Entity;
@@ -1043,7 +1044,7 @@ like this::
10431044
* @Assert\GroupSequenceProvider
10441045
* ...
10451046
*/
1046-
class User
1047+
class User implements GroupSequenceProviderInterface
10471048
{
10481049
// ...
10491050

0 commit comments

Comments
 (0)