-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Symfony version | 2., 3. |
Description: There is constraint "All" that allows us to provide several fundamental constraints that all has to be valid for validation to pass. There is no constraint "Any" for which we can provide several fundamental constraints expecting at least one of those to be valid.
Example: We can, per example, have several classes, Invoice, ProInvoice, DebitNote, CreditNote (accounting). For some property path, we can expect for, per example, Invoice or ProInvoice to be provided, example:
@Assert\Any([ @Assert\Type(type="Model\Invoice"), @Assert\Type(type="Model\ProInvoice") ])
This can be done differently, via Callback validator, or Expression validator, or whatever...
However, "Any" seams a "syntactic sugar", if there is no reason for "No" I would like to submit a PR.
ro0NL, linaori, fancyweb, ogizanagi, HeahDude and 3 more