GetterMetadata
class GetterMetadata extends MemberMetadata
Stores all metadata needed for validating a class property via its getter method.
A property getter is any method that is equal to the property's name, prefixed with either "get" or "is". That method will be used to access the property's value.
The getter will be invoked by reflection, so the access of private and protected getters 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.