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 |
string | $class | from MemberMetadata | |
string | $name | from MemberMetadata | |
string | $property | from MemberMetadata |
Methods
Returns the names of the properties that should be serialized.
Adds an list of constraints.
Returns all constraints for a given validation group.
Returns the strategy for traversing traversable objects.
Exists for compatibility with the deprecated {@link Symfony\Component\Validator\MetadataInterface}.
Constructor.
Returns whether this member is public.
Returns whether this member is protected
Returns whether this member is private.
Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry.
Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects.
Returns the reflection instance for accessing the member's value.
Extracts the value of the property from the given container.
Details
in MemberMetadata at line line 112
string[]
__sleep()
Returns the names of the properties that should be serialized.
in GenericMetadata at line line 97
__clone()
Clones this object.
in MemberMetadata at line line 95
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
in GenericMetadata at line line 173
GenericMetadata
addConstraints(array $constraints)
Adds an list of constraints.
in GenericMetadata at line line 185
Constraint[]
getConstraints()
Returns all constraints of this element.
in GenericMetadata at line line 195
bool
hasConstraints()
Returns whether this element has any constraints.
in GenericMetadata at line line 205
Constraint[]
findConstraints(string $group)
Returns all constraints for a given validation group.
in GenericMetadata at line line 215
int
getCascadingStrategy()
Returns the strategy for cascading objects.
in GenericMetadata at line line 223
int
getTraversalStrategy()
Returns the strategy for traversing traversable objects.
in MemberMetadata at line line 83
accept(ValidationVisitorInterface $visitor, mixed $value, string|string[] $group, string $propertyPath, $propagatedGroup = null)
deprecated
deprecated
Exists for compatibility with the deprecated {@link Symfony\Component\Validator\MetadataInterface}.
Should not be used.
at line line 39
__construct(string $class, string $name)
Constructor.
in MemberMetadata at line line 126
string
getName()
Returns the name of the member.
in MemberMetadata at line line 134
string
getClassName()
Returns the name of the backing PHP class.
in MemberMetadata at line line 142
string
getPropertyName()
Returns the name of the property.
in MemberMetadata at line line 154
bool
isPublic(object|string $objectOrClassName)
Returns whether this member is public.
in MemberMetadata at line line 166
bool
isProtected(object|string $objectOrClassName)
Returns whether this member is protected
in MemberMetadata at line line 178
bool
isPrivate(object|string $objectOrClassName)
Returns whether this member is private.
in MemberMetadata at line line 191
bool
isCascaded()
deprecated
deprecated
Returns whether objects stored in this member should be validated.
in MemberMetadata at line line 205
bool
isCollectionCascaded()
deprecated
deprecated
Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry.
in MemberMetadata at line line 219
bool
isCollectionCascadedDeeply()
deprecated
deprecated
Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects.
in MemberMetadata at line line 231
ReflectionMethod|ReflectionProperty
getReflectionMember(object|string $objectOrClassName)
Returns the reflection instance for accessing the member's value.
at line line 51
mixed
getPropertyValue($object)
Extracts the value of the property from the given container.