Typed data implementation of the validator MetadataInterface.
Expanded class hierarchy of Metadata
class Metadata implements PropertyMetadataInterface {
/**
* The name of the property, or empty if this is the root.
*
* @var string
*/
protected $name;
/**
* The typed data object the metadata is about.
*
* @var \Drupal\Core\TypedData\TypedDataInterface
*/
protected $typedData;
/**
* The metadata factory used.
*
* @var \Drupal\Core\TypedData\Validation\MetadataFactory
*/
protected $factory;
/**
* Constructs the object.
*
* @param \Drupal\Core\TypedData\TypedDataInterface $typed_data
* The typed data object the metadata is about.
* @param $name
* The name of the property to get metadata for. Leave empty, if
* the data is the root of the typed data tree.
* @param \Drupal\Core\TypedData\Validation\MetadataFactory $factory
* The factory to use for instantiating property metadata.
*/
public function __construct(TypedDataInterface $typed_data, $name = '', MetadataFactory $factory) {
$this->typedData = $typed_data;
$this->name = $name;
$this->factory = $factory;
}
/**
* Implements MetadataInterface::accept().
*/
public function accept(ValidationVisitorInterface $visitor, $typed_data, $group, $propertyPath) {
// @todo: Do we have to care about groups? Symfony class metadata has
// $propagatedGroup.
$visitor
->visit($this, $typed_data
->getValue(), $group, $propertyPath);
}
/**
* Implements MetadataInterface::findConstraints().
*/
public function findConstraints($group) {
return $this->typedData
->getConstraints();
}
/**
* Returns the name of the property.
*
* @return string The property name.
*/
public function getPropertyName() {
return $this->name;
}
/**
* Extracts the value of the property from the given container.
*
* @param mixed $container The container to extract the property value from.
*
* @return mixed The value of the property.
*/
public function getPropertyValue($container) {
return $this->typedData
->getValue();
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Metadata:: |
protected | property | The metadata factory used. | |
Metadata:: |
protected | property | The name of the property, or empty if this is the root. | |
Metadata:: |
protected | property | The typed data object the metadata is about. | |
Metadata:: |
public | function |
Implements MetadataInterface::accept(). Overrides MetadataInterface:: |
1 |
Metadata:: |
public | function |
Implements MetadataInterface::findConstraints(). Overrides MetadataInterface:: |
|
Metadata:: |
public | function |
Returns the name of the property. Overrides PropertyMetadataInterface:: |
|
Metadata:: |
public | function |
Extracts the value of the property from the given container. Overrides PropertyMetadataInterface:: |
|
Metadata:: |
public | function | Constructs the object. |