Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Closed
Description
Currently, the validator will traverse objects that implement\Traversable
if
- the object was reached via a
Valid
constraint withtraverse
set totrue
- the parameter
$traverse
was set totrue
when callingValidator::validate()
This has two negative consequences:
- it's impossible to specify only once that a specific class should never/always be traversed
- it's impossible to specify whether an object should be traversed when
Validator::validate()
is not called manually, but through another system (e.g. the Form component - see[Form][Bug] Embedded form validation bubbling #8557)
A solution would be to add configuration parameters for specifying the traversal policy on a class level, for example:
// not traversed by defaultclass Fooimplements \IteratorAggregate{// ...}// traversed/** @Assert\Traverse */class Barimplements \IteratorAggregate{}// traversed recursively/** @Assert\Traverse(deep=true) */class Bazimplements \IteratorAggregate{}