class PropertyMetadata in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/validator/Mapping/PropertyMetadata.php \Symfony\Component\Validator\Mapping\PropertyMetadata
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.
@author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\Mapping\GenericMetadata implements MetadataInterface
- class \Symfony\Component\Validator\Mapping\ElementMetadata
- class \Symfony\Component\Validator\Mapping\MemberMetadata implements PropertyMetadataInterface
- class \Symfony\Component\Validator\Mapping\PropertyMetadata
- class \Symfony\Component\Validator\Mapping\MemberMetadata implements PropertyMetadataInterface
- class \Symfony\Component\Validator\Mapping\ElementMetadata
Expanded class hierarchy of PropertyMetadata
See also
2 files declare their use of PropertyMetadata
- AbstractConstraintValidatorTest.php in vendor/
symfony/ validator/ Tests/ Constraints/ AbstractConstraintValidatorTest.php - PropertyMetadataTest.php in vendor/
symfony/ validator/ Tests/ Mapping/ PropertyMetadataTest.php
File
- vendor/
symfony/ validator/ Mapping/ PropertyMetadata.php, line 29
Namespace
Symfony\Component\Validator\MappingView source
class PropertyMetadata extends MemberMetadata {
/**
* Constructor.
*
* @param string $class The class this property is defined on
* @param string $name The name of this property
*
* @throws ValidatorException
*/
public function __construct($class, $name) {
if (!property_exists($class, $name)) {
throw new ValidatorException(sprintf('Property %s does not exist in class %s', $name, $class));
}
parent::__construct($class, $name, $name);
}
/**
* {@inheritdoc}
*/
public function getPropertyValue($object) {
return $this
->getReflectionMember($object)
->getValue($object);
}
/**
* {@inheritdoc}
*/
protected function newReflectionMember($objectOrClassName) {
$class = new \ReflectionClass($objectOrClassName);
while (!$class
->hasProperty($this
->getName())) {
$class = $class
->getParentClass();
}
$member = new \ReflectionProperty($class
->getName(), $this
->getName());
$member
->setAccessible(true);
return $member;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GenericMetadata:: |
public | property | The strategy for cascading objects. | |
GenericMetadata:: |
public | property | @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getConstraints()} and {@link findConstraints()} instead. | |
GenericMetadata:: |
public | property | @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link findConstraints()} instead. | |
GenericMetadata:: |
public | property | The strategy for traversing traversable objects. | 1 |
GenericMetadata:: |
public | function | Adds an list of constraints. | |
GenericMetadata:: |
public | function |
Aware of the global group (* group). Overrides MetadataInterface:: |
|
GenericMetadata:: |
public | function |
Returns the strategy for cascading objects. Overrides MetadataInterface:: |
1 |
GenericMetadata:: |
public | function |
Returns all constraints of this element. Overrides MetadataInterface:: |
|
GenericMetadata:: |
public | function |
Returns the strategy for traversing traversable objects. Overrides MetadataInterface:: |
|
GenericMetadata:: |
public | function | Returns whether this element has any constraints. | |
GenericMetadata:: |
public | function | Clones this object. | |
MemberMetadata:: |
public | property | @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getClassName()} instead. | |
MemberMetadata:: |
public | property | @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getName()} instead. | |
MemberMetadata:: |
public | property | @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getPropertyName()} instead. | |
MemberMetadata:: |
private | property | ||
MemberMetadata:: |
public | function |
Overrides GenericMetadata:: |
|
MemberMetadata:: |
public | function |
Adds a constraint. Overrides GenericMetadata:: |
|
MemberMetadata:: |
public | function |
Returns the name of the backing PHP class. Overrides ClassBasedInterface:: |
|
MemberMetadata:: |
public | function | Returns the name of the member. | |
MemberMetadata:: |
public | function |
Returns the name of the property. Overrides PropertyMetadataInterface:: |
|
MemberMetadata:: |
public | function | Returns the reflection instance for accessing the member's value. | |
MemberMetadata:: |
public | function | Returns whether objects stored in this member should be validated. | |
MemberMetadata:: |
public | function | Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry. | |
MemberMetadata:: |
public | function | Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects. | |
MemberMetadata:: |
public | function | Returns whether this member is private. | |
MemberMetadata:: |
public | function | Returns whether this member is protected. | |
MemberMetadata:: |
public | function | Returns whether this member is public. | |
MemberMetadata:: |
public | function |
Returns the names of the properties that should be serialized. Overrides GenericMetadata:: |
|
PropertyMetadata:: |
public | function |
Extracts the value of the property from the given container. Overrides PropertyMetadataInterface:: |
|
PropertyMetadata:: |
protected | function |
Creates a new reflection instance for accessing the member's value. Overrides MemberMetadata:: |
|
PropertyMetadata:: |
public | function |
Constructor. Overrides MemberMetadata:: |