PropertyMetadata
class PropertyMetadata extends MemberMetadata
Stores all metadata needed for validating a class property.
The value of the property is obtained by directly accessing the property. The property will be accessed by reflection, so the access of private and protected properties is supported.
This class supports serialization and cloning.
Properties
Constraint[] | $constraints | from GenericMetadata | |
array | $constraintsByGroup | from GenericMetadata | |
int | $cascadingStrategy | The strategy for cascading objects. | from GenericMetadata |
int | $traversalStrategy | The strategy for traversing traversable objects. | from GenericMetadata |
$class | from MemberMetadata | ||
$name | from MemberMetadata | ||
$property | from MemberMetadata |
Methods
Returns the names of the properties that should be serialized.
Returns all constraints for a given validation group.
Returns the strategy for traversing traversable objects.
No description
Returns whether this member is public.
Returns whether this member is protected.
Returns whether this member is private.
Returns the reflection instance for accessing the member's value.
Creates a new reflection instance for accessing the member's value.
Extracts the value of the property from the given container.
Details
$this
addConstraint(Constraint $constraint)
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:
- {@link TraversalStrategy::IMPLICIT} if $traverse is enabled
- {@link TraversalStrategy::NONE} if $traverse is disabled
ReflectionMethod|ReflectionProperty
getReflectionMember(object|string $objectOrClassName)
Returns the reflection instance for accessing the member's value.
protected ReflectionMethod|ReflectionProperty
newReflectionMember(object|string $objectOrClassName)
Creates a new reflection instance for accessing the member's value.
Must be implemented by subclasses.