ConstraintValidatorInterface::validate()

validate(mixed $value, Constraint $constraint) Checks if the passed value is valid. Parameters mixed $value The value that should be validated Constraint $constraint The constraint for the validation

ConstraintValidatorInterface::initialize()

initialize(ExecutionContextInterface $context) Initializes the constraint validator. Parameters ExecutionContextInterface $context The current validation context

ConstraintValidatorInterface

interface ConstraintValidatorInterface Methods initialize(ExecutionContextInterface $context) Initializes the constraint validator. validate(mixed $value, Constraint $constraint) Checks if the passed value is valid. Details initialize(ExecutionContextInterface $context) Initializes the constraint validator. Parameters ExecutionContextInterface $context The current validation context validate(mixed $value, Co

ConstraintValidatorFactoryInterface

interface ConstraintValidatorFactoryInterface Specifies an object able to return the correct ConstraintValidatorInterface instance given a Constraint object. Methods ConstraintValidatorInterface getInstance(Constraint $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. Details ConstraintValidatorInterface getInstance(Constraint $constraint) Given a Constraint, this re

ConstraintValidatorFactory

class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface Default implementation of the ConstraintValidatorFactoryInterface. This enforces the convention that the validatedBy() method on any Constraint will return the class name of the ConstraintValidator that should validate the Constraint. Methods __construct() ConstraintValidatorInterface getInstance(Constraint $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should

ConstraintValidatorFactory

class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface Uses a service container to create constraint validators. A constraint validator should be tagged as "validator.constraint_validator" in the service container and include an "alias" attribute: <service id="some_doctrine_validator"> <argument type="service" id="doctrine.orm.some_entity_manager" /> <tag name="validator.constraint_validator" alias="some_alias" /> </service> A constra

ConstraintValidator

class ConstraintValidator implements ConstraintValidatorInterface Base class for constraint validators. Constants PRETTY_DATE Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s"). OBJECT_TO_STRING Whether to cast objects with a "__toString()" method to strings. Methods initialize(ExecutionContextInterface $context) Initializes the constraint validator. Details initialize(ExecutionContextInterface $context) Init

ConstraintDefinitionException

class ConstraintDefinitionException extends ValidatorException

Constraint::validatedBy()

string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. Return Value string

Constraint::getTargets()

string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASSCONSTRAINT and Constraint::PROPERTYCONSTRAINT. Return Value string|array One or more constant values