I have an application which has differtent entities with a password property. At the moment each entity has a repeated group of property constraints for the password property:
<?php
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
// ...
$metadata->addPropertyConstraint('password', new Length(...);
$metadata->addPropertyConstraint('password', new NotBlank(...);
$metadata->addPropertyConstraint('password', new Custom1(...);
$metadata->addPropertyConstraint('password', new Custom2(...);
// ...
}
I would like to have a custom validator "PasswordValidator" which "groups" all the different constraints as mentioned above. In that case, I only need to add one property constraint to each password property.
Like this:
<?php
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
// ...
$metadata->addPropertyConstraint('password', new MyCustomPassword(...);
// ...
}
Any ideas?