@@ -23,30 +23,6 @@ If your valid choice list is simple, you can pass them in directly via the
2323
2424.. configuration-block ::
2525
26- .. code-block :: php-annotations
27-
28- // src/Entity/Author.php
29- namespace App\Entity;
30-
31- use Symfony\Component\Validator\Constraints as Assert;
32-
33- class Author
34- {
35- const GENRES = ['fiction', 'non-fiction'];
36-
37- /**
38- * @Assert\Choice({"New York", "Berlin", "Tokyo"})
39- */
40- protected $city;
41-
42- /**
43- * You can also directly provide an array constant to the "choices" option in the annotation
44- *
45- * @Assert\Choice(choices=Author::GENRES, message="Choose a valid genre.")
46- */
47- protected $genre;
48- }
49-
5026 .. code-block :: php-attributes
5127
5228 // src/Entity/Author.php
@@ -152,21 +128,6 @@ constraint.
152128
153129.. configuration-block ::
154130
155- .. code-block :: php-annotations
156-
157- // src/Entity/Author.php
158- namespace App\Entity;
159-
160- use Symfony\Component\Validator\Constraints as Assert;
161-
162- class Author
163- {
164- /**
165- * @Assert\Choice(callback="getGenres")
166- */
167- protected $genre;
168- }
169-
170131 .. code-block :: php-attributes
171132
172133 // src/Entity/Author.php
@@ -230,21 +191,6 @@ you can pass the class name and the method as an array.
230191
231192.. configuration-block ::
232193
233- .. code-block :: php-annotations
234-
235- // src/Entity/Author.php
236- namespace App\Entity;
237-
238- use Symfony\Component\Validator\Constraints as Assert;
239-
240- class Author
241- {
242- /**
243- * @Assert\Choice(callback={"App\Entity\Genre", "getGenres"})
244- */
245- protected $genre;
246- }
247-
248194 .. code-block :: php-attributes
249195
250196 // src/Entity/Author.php
0 commit comments