Mapping\GetterMetadata (Component\Validator)
Symfony\Component\Validator\Mapping\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 | |
array | $constraintsByGroup | |
int | $cascadingStrategy | The strategy for cascading objects. |
int | $traversalStrategy | The strategy for traversing traversable objects. |
string | $class | |
string | $name | |
string | $property |
Methods
string[] | __sleep() Returns the names of the properties that should be serialized. | from MemberMetadata |
__clone() Clones this object. | from GenericMetadata | |
GenericMetadata | addConstraint(Constraint $constraint) Adds a constraint. | from MemberMetadata |
GenericMetadata | 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 |
accept(ValidationVisitorInterface $visitor, mixed $value, string|string[] $group, string $propertyPath, $propagatedGroup = null) Exists for compatibility with the deprecated {@link Symfony\Component\Validator\MetadataInterface}. | from MemberMetadata | |
__construct(string $class, string $property) Constructor. | ||
string | getName() Returns the name of the member. | from MemberMetadata |
string | getClassName() Returns the name of the backing PHP class. | 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 |
bool | isCascaded() Returns whether objects stored in this member should be validated. | from MemberMetadata |
bool | isCollectionCascaded() Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry. | from MemberMetadata |
bool | isCollectionCascadedDeeply() Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects. | from MemberMetadata |
ReflectionMethod|ReflectionProperty | getReflectionMember(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. | from MemberMetadata |
mixed | getPropertyValue($object) Extracts the value of the property from the given container. |
Details
public string[] __sleep()
Returns the names of the properties that should be serialized.
public __clone()
Clones this object.
public GenericMetadata 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 properties $traverse and $deep of that constraint, the traversal strategy will be set to one of the following:
- {@link TraversalStrategy::IMPLICIT} if $traverse is enabled and $deep is enabled
- {@link TraversalStrategy::IMPLICIT} | {@link TraversalStrategy::STOP_RECURSION} if $traverse is enabled, but $deep is disabled
- {@link TraversalStrategy::NONE} if $traverse is disabled
public GenericMetadata addConstraints(array $constraints)
Adds an list of constraints.
public Constraint[] getConstraints()
Returns all constraints of this element.
public bool hasConstraints()
Returns whether this element has any constraints.
public Constraint[] findConstraints(string $group)
Returns all constraints for a given validation group.
public int getCascadingStrategy()
Returns the strategy for cascading objects.
public int getTraversalStrategy()
Returns the strategy for traversing traversable objects.
public accept(ValidationVisitorInterface $visitor, mixed $value, string|string[] $group, string $propertyPath, $propagatedGroup = null)
Exists for compatibility with the deprecated {@link Symfony\Component\Validator\MetadataInterface}.
Should not be used.
public __construct(string $class, string $property)
Constructor.
public string getName()
Returns the name of the member.
public string getClassName()
Returns the name of the backing PHP class.
public string getPropertyName()
Returns the name of the property.
public bool isPublic(object|string $objectOrClassName)
Returns whether this member is public.
public bool isProtected(object|string $objectOrClassName)
Returns whether this member is protected
public bool isPrivate(object|string $objectOrClassName)
Returns whether this member is private.
public bool isCascaded()
Returns whether objects stored in this member should be validated.
public bool isCollectionCascaded()
Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry.
public bool isCollectionCascadedDeeply()
Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects.
public ReflectionMethod|ReflectionProperty getReflectionMember(object|string $objectOrClassName)
Returns the reflection instance for accessing the member's value.
public mixed getPropertyValue($object)
Extracts the value of the property from the given container.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Validator/Mapping/GetterMetadata.html