function TypedDataAwareValidatorTrait::getTypedData
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/Validation/TypedDataAwareValidatorTrait.php \Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait::getTypedData()
- 10 core/lib/Drupal/Core/TypedData/Validation/TypedDataAwareValidatorTrait.php \Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait::getTypedData()
- 11.x core/lib/Drupal/Core/TypedData/Validation/TypedDataAwareValidatorTrait.php \Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait::getTypedData()
Gets the typed data object for the validated value.
Return value
\Drupal\Core\TypedData\TypedDataInterface The typed data object.
5 calls to TypedDataAwareValidatorTrait::getTypedData()
- AllowedValuesConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ AllowedValuesConstraintValidator.php - ComplexDataConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ ComplexDataConstraintValidator.php - IsNullConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ IsNullConstraintValidator.php - NotNullConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ NotNullConstraintValidator.php - PrimitiveTypeConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ PrimitiveTypeConstraintValidator.php
File
-
core/
lib/ Drupal/ Core/ TypedData/ Validation/ TypedDataAwareValidatorTrait.php, line 21
Class
- TypedDataAwareValidatorTrait
- Defines a trait to access the typed data object of a validated value.
Namespace
Drupal\Core\TypedData\ValidationCode
public function getTypedData() {
$context = $this->context;
/** @var \Symfony\Component\Validator\Context\ExecutionContextInterface $context */
$data = $context->getObject();
if (!$data instanceof TypedDataInterface) {
throw new \LogicException("There is no Typed Data object available.");
}
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.