8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83912c6 commit 5dbab03Copy full SHA for 5dbab03
reference/constraints/Collection.rst
@@ -239,6 +239,29 @@ you can do the following:
239
protected $profileData = ['personal_email' => 'email@example.com'];
240
}
241
242
+ .. code-block:: php-attributes
243
+
244
+ // src/Entity/Author.php
245
+ namespace App\Entity;
246
247
+ use Symfony\Component\Validator\Constraints as Assert;
248
249
+ class Author
250
+ {
251
+ #[Assert\Collection(
252
+ fields: [
253
+ 'personal_email' => new Assert\Required([
254
+ new Assert\NotBlank,
255
+ new Assert\Email,
256
+ ]),
257
+ 'alternate_email' => new Assert\Optional(
258
+ new Assert\Email
259
+ ),
260
+ ],
261
+ )]
262
+ protected $profileData = ['personal_email' => 'email@example.com'];
263
+ }
264
265
.. code-block:: yaml
266
267
# config/validator/validation.yaml
0 commit comments