public function RecursiveContextualValidator::validateProperty in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/validator/Validator/RecursiveContextualValidator.php \Symfony\Component\Validator\Validator\RecursiveContextualValidator::validateProperty()
- 8.0 core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php \Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validateProperty()
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php \Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validateProperty()
Validates a property of an object against the constraints specified for this property.
Parameters
object $object The object:
string $propertyName The name of the validated property:
array|null $groups The validation groups to validate. If: none is given, "Default" is assumed
Return value
ContextualValidatorInterface This validator
Overrides ContextualValidatorInterface::validateProperty
File
- core/
lib/ Drupal/ Core/ TypedData/ Validation/ RecursiveContextualValidator.php, line 204 - Contains \Drupal\Core\TypedData\Validation\RecursiveContextualValidator.
Class
- RecursiveContextualValidator
- Defines a recursive contextual validator for Typed Data.
Namespace
Drupal\Core\TypedData\ValidationCode
public function validateProperty($object, $propertyName, $groups = NULL) {
if (isset($groups)) {
throw new \LogicException('Passing custom groups is not supported.');
}
if (!is_object($object)) {
throw new \InvalidArgumentException('Passing class name is not supported.');
}
elseif (!$object instanceof TypedDataInterface) {
throw new \InvalidArgumentException('The passed in object has to be typed data.');
}
elseif (!$object instanceof ListInterface && !$object instanceof ComplexDataInterface) {
throw new \InvalidArgumentException('Passed data does not contain properties.');
}
return $this
->validateNode($object
->get($propertyName), NULL, TRUE);
}