class GenericMetadata implements MetadataInterface
A generic container of {@link Constraint} objects.
This class supports serialization and cloning.
| Constraint[] | $constraints | ||
| array | $constraintsByGroup | ||
| int | $cascadingStrategy | The strategy for cascading objects. | |
| int | $traversalStrategy | The strategy for traversing traversable objects. |
| string[] | __sleep() Returns the names of the properties that should be serialized. | |
| __clone() Clones this object. | ||
| $this | addConstraint(Constraint $constraint) Adds a constraint. | |
| $this | addConstraints(array $constraints) Adds an list of constraints. | |
| Constraint[] | getConstraints() Returns all constraints of this element. | |
| bool | hasConstraints() Returns whether this element has any constraints. | |
| Constraint[] | findConstraints(string $group) Returns all constraints for a given validation group. | |
| int | getCascadingStrategy() Returns the strategy for cascading objects. | |
| int | getTraversalStrategy() Returns the strategy for traversing traversable objects. |
Returns the names of the properties that should be serialized.
| string[] |
Clones this object.
Adds a constraint.
If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following:
| Constraint | $constraint |
| $this |
| ConstraintDefinitionException | When trying to add the {@link Traverse} constraint |
Adds an list of constraints.
| array | $constraints | The constraints to add |
| $this |
Returns all constraints of this element.
| Constraint[] | A list of Constraint instances |
Returns whether this element has any constraints.
| bool |
Returns all constraints for a given validation group.
| string | $group | The validation group |
| Constraint[] | A list of constraint instances |
Returns the strategy for cascading objects.
| int | The cascading strategy |
Returns the strategy for traversing traversable objects.
| int | The traversal strategy |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Mapping/GenericMetadata.html