Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContextualValidatorInterface.php

interface ContextualValidatorInterface

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/TypedData/Validation/ContextualValidatorInterface.php \Drupal\Core\TypedData\Validation\ContextualValidatorInterface

A validator in a specific execution context.

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

  • interface \Symfony\Component\Validator\Validator\ContextualValidatorInterface

Expanded class hierarchy of ContextualValidatorInterface

All classes that implement ContextualValidatorInterface

3 files declare their use of ContextualValidatorInterface
ConstraintValidatorTestCase.php in vendor/symfony/validator/Test/ConstraintValidatorTestCase.php
ContextualValidatorInterface.php in core/lib/Drupal/Core/TypedData/Validation/ContextualValidatorInterface.php
RecursiveValidator.php in core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php

File

vendor/symfony/validator/Validator/ContextualValidatorInterface.php, line 23

Namespace

Symfony\Component\Validator\Validator
View source
interface ContextualValidatorInterface {
    
    /**
     * Appends the given path to the property path of the context.
     *
     * If called multiple times, the path will always be reset to the context's
     * original path with the given path appended to it.
     *
     * @return $this
     */
    public function atPath(string $path) : static;
    
    /**
     * Validates a value against a constraint or a list of constraints.
     *
     * If no constraint is passed, the constraint
     * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
     *
     * @param mixed                                                 $value       The value to validate
     * @param Constraint|Constraint[]|null                          $constraints The constraint(s) to validate against
     * @param string|GroupSequence|array<string|GroupSequence>|null $groups      The validation groups to validate. If none is given, "Default" is assumed
     *
     * @return $this
     */
    public function validate(mixed $value, Constraint|array|null $constraints = null, string|GroupSequence|array|null $groups = null) : static;
    
    /**
     * Validates a property of an object against the constraints specified
     * for this property.
     *
     * @param string                                                $propertyName The name of the validated property
     * @param string|GroupSequence|array<string|GroupSequence>|null $groups       The validation groups to validate. If none is given, "Default" is assumed
     *
     * @return $this
     */
    public function validateProperty(object $object, string $propertyName, string|GroupSequence|array|null $groups = null) : static;
    
    /**
     * Validates a value against the constraints specified for an object's
     * property.
     *
     * @param object|string                                         $objectOrClass The object or its class name
     * @param string                                                $propertyName  The name of the property
     * @param mixed                                                 $value         The value to validate against the property's constraints
     * @param string|GroupSequence|array<string|GroupSequence>|null $groups        The validation groups to validate. If none is given, "Default" is assumed
     *
     * @return $this
     */
    public function validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|GroupSequence|array|null $groups = null) : static;
    
    /**
     * Returns the violations that have been generated so far in the context
     * of the validator.
     */
    public function getViolations() : ConstraintViolationListInterface;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ContextualValidatorInterface::atPath public function Appends the given path to the property path of the context. 3
ContextualValidatorInterface::getViolations public function Returns the violations that have been generated so far in the context
of the validator.
3
ContextualValidatorInterface::validate public function Validates a value against a constraint or a list of constraints. 3
ContextualValidatorInterface::validateProperty public function Validates a property of an object against the constraints specified
for this property.
3
ContextualValidatorInterface::validatePropertyValue public function Validates a value against the constraints specified for an object&#039;s
property.
3

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal