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.
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 |
string[] | __sleep() Returns the names of the properties that should be serialized. | from MemberMetadata |
__clone() Clones this object. | from GenericMetadata | |
$this | addConstraint(Constraint $constraint) Adds a constraint. | from MemberMetadata |
$this | addConstraints(array $constraints) Adds an list of constraints. | from GenericMetadata |
Constraint[] | getConstraints() Returns all constraints of this element. | from GenericMetadata |
bool | hasConstraints() Returns whether this element has any constraints. | from GenericMetadata |
Constraint[] | findConstraints(string $group) Returns all constraints for a given validation group. | from GenericMetadata |
int | getCascadingStrategy() Returns the strategy for cascading objects. | from GenericMetadata |
int | getTraversalStrategy() Returns the strategy for traversing traversable objects. | from GenericMetadata |
__construct(string $class, string $property, string $method = null) | ||
string | getName() Returns the name of the member. | from MemberMetadata |
getClassName() {@inheritdoc} | from MemberMetadata | |
string | getPropertyName() Returns the name of the property. | from MemberMetadata |
bool | isPublic(object|string $objectOrClassName) Returns whether this member is public. | from MemberMetadata |
bool | isProtected(object|string $objectOrClassName) Returns whether this member is protected. | from MemberMetadata |
bool | isPrivate(object|string $objectOrClassName) Returns whether this member is private. | from MemberMetadata |
ReflectionMethod|ReflectionProperty | getReflectionMember(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. | from MemberMetadata |
ReflectionMethod|ReflectionProperty | newReflectionMember(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. | |
mixed | getPropertyValue($object) Extracts the value of the property from the given container. |
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 |
string | $class | The name of the class this member is defined on |
string | $property | The property the member belongs to |
string | $method | The method that is called to retrieve the value being validated (null for auto-detection) |
ValidatorException |
Returns the name of the member.
string |
{@inheritdoc}
Returns the name of the property.
string | The property name |
Returns whether this member is public.
object|string | $objectOrClassName | The object or the class name |
bool |
Returns whether this member is protected.
object|string | $objectOrClassName | The object or the class name |
bool |
Returns whether this member is private.
object|string | $objectOrClassName | The object or the class name |
bool |
Returns the reflection instance for accessing the member's value.
object|string | $objectOrClassName | The object or the class name |
ReflectionMethod|ReflectionProperty | The reflection instance |
Creates a new reflection instance for accessing the member's value.
Must be implemented by subclasses.
object|string | $objectOrClassName | The object or the class name |
ReflectionMethod|ReflectionProperty | The reflection instance |
Extracts the value of the property from the given container.
$object |
mixed | The value of the property |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Mapping/GetterMetadata.html