public RecursiveContextualValidator::validateProperty($object, $propertyName, $groups = NULL)
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 199
Class
- RecursiveContextualValidator
- Defines a recursive contextual validator for Typed Data.
Namespace
Drupal\Core\TypedData\Validation
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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); } |
Please login to continue.