@@ -23,30 +23,6 @@ If your valid choice list is simple, you can pass them in directly via the
23
23
24
24
.. configuration-block ::
25
25
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
-
50
26
.. code-block :: php-attributes
51
27
52
28
// src/Entity/Author.php
@@ -152,21 +128,6 @@ constraint.
152
128
153
129
.. configuration-block ::
154
130
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
-
170
131
.. code-block :: php-attributes
171
132
172
133
// src/Entity/Author.php
@@ -230,21 +191,6 @@ you can pass the class name and the method as an array.
230
191
231
192
.. configuration-block ::
232
193
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
-
248
194
.. code-block :: php-attributes
249
195
250
196
// src/Entity/Author.php
0 commit comments