TypedDataMetadata.php
Same filename in other branches
Namespace
Drupal\Core\TypedData\ValidationFile
-
core/
lib/ Drupal/ Core/ TypedData/ Validation/ TypedDataMetadata.php
View source
<?php
namespace Drupal\Core\TypedData\Validation;
use Drupal\Core\TypedData\TypedDataInterface;
use Symfony\Component\Validator\Mapping\CascadingStrategy;
use Symfony\Component\Validator\Mapping\MetadataInterface;
use Symfony\Component\Validator\Mapping\TraversalStrategy;
/**
* Validator metadata for typed data objects.
*
* @see \Drupal\Core\TypedData\Validation\RecursiveValidator::getMetadataFor()
*/
class TypedDataMetadata implements MetadataInterface {
/**
* The typed data object the metadata is about.
*
* @var \Drupal\Core\TypedData\TypedDataInterface
*/
protected $typedData;
/**
* Constructs the object.
*
* @param \Drupal\Core\TypedData\TypedDataInterface $typed_data
* The typed data object the metadata is about.
*/
public function __construct(TypedDataInterface $typed_data) {
$this->typedData = $typed_data;
}
/**
* {@inheritdoc}
*/
public function findConstraints($group) {
return $this->getConstraints();
}
/**
* {@inheritdoc}
*/
public function getConstraints() {
return $this->typedData
->getConstraints();
}
/**
* {@inheritdoc}
*/
public function getTraversalStrategy() {
return TraversalStrategy::NONE;
}
/**
* {@inheritdoc}
*/
public function getCascadingStrategy() {
// By default, never cascade into validating referenced data structures.
return CascadingStrategy::NONE;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
TypedDataMetadata | Validator metadata for typed data objects. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.