Expanded class hierarchy of PropertyMetadata
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;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ElementMetadata:: |
public | property | ||
ElementMetadata:: |
public | property | ||
ElementMetadata:: |
public | function | Returns the constraints of the given group and global ones (* group). | |
ElementMetadata:: |
public | function | Returns all constraints of this element. | |
ElementMetadata:: |
public | function | Returns whether this element has any constraints. | |
ElementMetadata:: |
public | function | Clones this object. | |
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
public | property | ||
MemberMetadata:: |
private | property | ||
MemberMetadata:: |
public | function |
Implementation of the Visitor design pattern. Overrides MetadataInterface:: |
|
MemberMetadata:: |
public | function |
Adds a constraint to this element. Overrides ElementMetadata:: |
|
MemberMetadata:: |
public | function |
Returns the class this member is defined on Overrides ClassBasedInterface:: |
|
MemberMetadata:: |
public | function | Returns the name of the member | |
MemberMetadata:: |
public | function |
Returns the name of the property this member belongs to Overrides PropertyMetadataInterface:: |
|
MemberMetadata:: |
public | function | Returns the Reflection instance of the member | |
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 ElementMetadata:: |
|
PropertyMetadata:: |
public | function |
Extracts the value of the property from the given container. Overrides PropertyMetadataInterface:: |
|
PropertyMetadata:: |
protected | function |
Creates a new Reflection instance for the member Overrides MemberMetadata:: |
|
PropertyMetadata:: |
public | function |
Constructor. Overrides MemberMetadata:: |