Cascade
constraint to ease validating nested typed object propertiesallowEmptyString
option of the Length
constraintBefore:
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\Length(min=5, allowEmptyString=true)
*/
After:
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\AtLeastOneOf({
* @Assert\Blank(),
* @Assert\Length(min=5)
* })
*/
Isin
constraint and validatorULID
constraint and validatorUuid
constraintNumberConstraintTrait
traitValidatorBuilder::enableAnnotationMapping()
, pass true
as first parameter and additionally call setDoctrineAnnotationReader()
or addDefaultDoctrineAnnotationReader()
to set up the annotation readerHostname
constraint and validatoralpha3
option to the Country
and Language
constraintsCompound
constraintSequentially
constraint, to sequentially validate a set of constraints (any violation raised will prevent further validation of the nested constraints)divisibleBy
option to the Count
constraintExpressionLanguageSyntax
constraintExpressionLanguage
instance or null must be passed as the first argument of ExpressionValidator::__construct()
checkDNS
and dnsMessage
options of the Url
constraintcheckMX
, checkHost
and strict
options of the Email
constraint\DateTimeInterface
in DateTimeValidator
, DateValidator
and TimeValidator
Bic
, Country
, Currency
, Language
and Locale
constraints without symfony/intl
Email
constraint without egulias/email-validator
Expression
constraint without symfony/expression-language
canonicalize
option of Locale
constraint to true
ValidatorBuilderInterface
ConstraintViolation
is not allowedLength::$allowEmptyString
to false
and made it optionalSymfony\Component\Validator\Mapping\Cache\CacheInterface
in favor of PSR-6.ValidatorBuilder::setMetadataCache
, use ValidatorBuilder::setMappingCache
instead.$classValidatorRegexp
value in PropertyInfoLoader::__construct
will not enable auto-mapping for all classes anymore, use '{.*}'
instead.EnableAutoMapping
and DisableAutoMapping
constraints to enable or disable auto mapping for class or a propertystring
as the code of a ConstraintViolation
is deprecated, a string
type-hint will
be added to the constructor of the ConstraintViolation
class and to the ConstraintViolationBuilder::setCode()
method in 5.0ExpressionLanguage
instance as the second argument of ExpressionValidator::__construct()
. Pass it as the first argument instead.compared_value_path
parameter in violations when using any
comparison constraint with the propertyPath
option.TypeValidator
allowEmptyString
option to the Length
constraint to allow rejecting empty strings when min
is set, by setting it to false
.minPropertyPath
and maxPropertyPath
options
to Range
constraint in order to get the value to compare
from an array or objectmin_limit_path
and max_limit_path
parameters in violations when using
Range
constraint with respectively the minPropertyPath
and
maxPropertyPath
optionsnotInRangeMessage
option to the Range
constraint that will
be used in the violation builder when both min
and max
are not nullConstraintValidatorTestCase::setUp()
and ConstraintValidatorTestCase::tearDown()
without the void
return-type is deprecated.Symfony\Component\Validator\Mapping\Cache\CacheInterface
in favor of PSR-6.ValidatorBuilder::setMetadataCache
, use ValidatorBuilder::setMappingCache
instead.ValidatorDataCollector
class as @final
.Timezone
constraintNotCompromisedPassword
constraintiban
and ibanPropertyPath
to Bic constraintCardSchemeValidator
allowNull
to NotBlank constraintJson
constraintUnique
constraintnormalizer
option to the string constraints and to the NotBlank
constraintPositive
constraintPositiveOrZero
constraintNegative
constraintNegativeOrZero
constraintUnexpectedValueException
that can be thrown by constraint validators, these exceptions are caught by
the validator and are converted into constraint violationsDivisibleBy
constraintsymfony/translation
by using Symfony\Contracts\Translation\TranslatorInterface
ValidatorBuilderInterface
ValidatorBuilder::setTranslator()
finalformat
the default option in DateTime
constraint\DateTimeInterface
in DateTimeValidator
, DateValidator
and TimeValidator
.Bic
, Country
, Currency
, Language
and Locale
constraints without symfony/intl
Email
constraint without egulias/email-validator
Expression
constraint without symfony/expression-language
checkDNS
and dnsMessage
options of the Url
constraint.values
option to the Expression
constraintLocale
constraint without setting true
at "canonicalize" option, which will be the default value in 5.0strict
option of the Choice
constraint to anything but true
is not supported anymore.DateTimeValidator::PATTERN
constantAbstractConstraintValidatorTest
classcheckDNS
option of the Url
constraint to true
Valid
constraintstrict
option of the Choice
constraint to true
is
deprecated and will throw an exception in Symfony 4.0checkDNS
option of the Url
constraint to true
is deprecated in favor of
the Url::CHECK_DNS_TYPE_*
constants values and will throw an exception in Symfony 4.0Image
constraint via minPixels
and maxPixels
AddValidatorInitializersPass
AddConstraintValidatorsPass
ContainerConstraintValidatorFactory
Tests\Constraints\AbstractContraintValidatorTest
in favor of Test\ConstraintValidatorTestCase
DateTimeValidator::PATTERN
constantformat
option to the DateTime
constraintDefaultTranslator
in favor of Symfony\Component\Translation\IdentityTranslator
Is
-prefixed equivalentFileValidator
disallow empty filesUserPasswordValidator
source message changeExecutionContextInterface::setConstraint()
ConstraintViolation::getConstraint()
ExpressionValidator
will now evaluate the Expression even when the property value is null or an empty stringClassMetadata::hasMemberMetadatas()
ClassMetadata::getMemberMetadatas()
ClassMetadata::addMemberMetadata()
Mapping\MetadataInterface::getConstraints()
ConstraintViolationBuilderInterface::setCause()
ApcCache
in favor of DoctrineCache
DoctrineCache
to adapt any Doctrine cacheGroupSequence
now implements ArrayAccess
, Countable
and Traversable
ClassMetadata::getGroupSequence()
to return a GroupSequence
instance instead of an arrayCallback
can now be put onto properties (useful when you pass a closure to the constraint)ClassBasedInterface
MetadataInterface
PropertyMetadataInterface
PropertyMetadataContainerInterface
Mapping\ElementMetadata
Mapping\MetadataInterface
Mapping\ClassMetadataInterface
Mapping\PropertyMetadataInterface
Mapping\GenericMetadata
Mapping\CascadingStrategy
Mapping\TraversalStrategy
Mapping\ClassMetadata::accept()
Mapping\MemberMetadata::accept()
Mapping\ClassMetadata::setGroupSequence()
MetadataFactoryInterface
Mapping\BlackholeMetadataFactory
Mapping\ClassMetadataFactory
Mapping\Factory\MetadataFactoryInterface
Mapping\Factory\BlackHoleMetadataFactory
Mapping\Factory\LazyLoadingMetadataFactory
ExecutionContextInterface
ExecutionContext
GlobalExecutionContextInterface
Context\ExecutionContextInterface
Context\ExecutionContext
Context\ExecutionContextFactoryInterface
Context\ExecutionContextFactory
ValidatorInterface
Validator
ValidationVisitorInterface
ValidationVisitor
Validator\ValidatorInterface
Validator\RecursiveValidator
Validator\ContextualValidatorInterface
Validator\RecursiveContextualValidator
Violation\ConstraintViolationBuilderInterface
Violation\ConstraintViolationBuilder
ConstraintViolation::getParameters()
ConstraintViolation::getPlural()
Constraints\Traverse
$deep
property in Constraints\Valid
ValidatorBuilderInterface::setApiVersion()
Validation::API_VERSION_2_4
Validation::API_VERSION_2_5
Exception\OutOfBoundsException
Exception\UnsupportedMetadataException
Exception\ValidatorException
extend Exception\RuntimeException
Util\PropertyPath
ValidatorBuilder::setPropertyAccessor()
validate
and validateValue
on Validator\Context\ExecutionContext
use getValidator()
together with inContext()
insteadminRatio
, maxRatio
, allowSquare
, allowLandscape
, and allowPortrait
to Image validatorOptional
and Required
to the
Symfony\Component\Validator\Constraints\
namespace and deprecated the original
classes.Validator
to ValidatorInterface
ConstraintViolation
to the new ConstraintViolationInterface
ConstraintViolationList
to the new ConstraintViolationListInterface
ExecutionContext
to the new ExecutionContextInterface
ConstraintValidatorInterface::initialize
is now type hinted against ExecutionContextInterface
instead of ExecutionContext
Validator
from protected to privateClassMetadataFactoryInterface
in favor of the new MetadataFactoryInterface
ClassMetadataFactory::getClassMetadata
in favor of getMetadataFor
MetadataInterface
, PropertyMetadataInterface
, ClassBasedInterface
and PropertyMetadataContainerInterface
GraphWalker
in favor of the new ValidationVisitorInterface
ExecutionContext::addViolationAtPath
ExecutionContext::addViolationAtSubPath
in favor of ExecutionContextInterface::addViolationAt
ExecutionContext::getCurrentClass
in favor of ExecutionContextInterface::getClassName
ExecutionContext::getCurrentProperty
in favor of ExecutionContextInterface::getPropertyName
ExecutionContext::getCurrentValue
in favor of ExecutionContextInterface::getValue
ExecutionContext::getGraphWalker
in favor of ExecutionContextInterface::validate
and ExecutionContextInterface::validateValue
ValidatorInterface::validateValue
to accept arrays of constraintsValidatorInterface::getMetadataFactory
to return a MetadataFactoryInterface
instead of a ClassMetadataFactoryInterface
ClassMetadataFactoryInterface
type hint from ValidatorBuilderInterface::setMetadataFactory
.
As of Symfony 2.3, this method will be typed against MetadataFactoryInterface
instead.traverse
and deep
in the Valid
constraint and in GraphWalker::walkReference
are ignored for arrays now. Arrays are always traversed recursively.$message
in the constructor of ConstraintViolation
$translator
and $translationDomain
in the constructor of ExecutionContext
$translator
and $translationDomain
in the constructor of GraphWalker
$translator
and $translationDomain
in the constructor of ValidationVisitor
$translator
and $translationDomain
in the constructor of Validator
setTranslator()
and setTranslationDomain()
to ValidatorBuilderInterface
ctype_*
assertions in TypeValidator
extraFieldsMessage
and missingFieldsMessage
in Collection constraintsetMessage
, getMessageTemplate
and
getMessageParameters
isValid
has been renamed to
validate
, its return value was dropped. ConstraintValidator still contains
isValid
for BCValid
are not traversed
recursively anymore by default. Valid
contains a new property deep
which enables the BC behavior.