src/Container.php
public function configureValidationComponents(ContainerBuilder $containerBuilder): void
    {
        $containerBuilder->getDefinition(EntityDataValidator::class)
                         ->setFactory(
                             [
                                 new Reference(EntityDataValidatorFactory::class),
                                 'buildEntityDataValidator',
                             ]
                         )->setShared(false);
    }
public function configureValidationComponents(ContainerBuilder $containerBuilder): void
    {
        $containerBuilder->getDefinition(EntityDataValidator::class)
                         ->setFactory(
                             [
                                 new Reference(EntityDataValidatorFactory::class),
                                 'buildEntityDataValidator',
                             ]
                         )->setShared(false);
    }
public function configureValidationComponents ( ContainerBuilder $ containerBuilder ) : void { $ containerBuilder -> getDefinition ( EntityDataValidator :: class ) -> setFactory ( [ new Reference ( EntityDataValidatorFactory :: class ) , 'buildEntityDataValidator' , ] ) -> setShared ( false ) ; }
Ensure we are using the container constraint validator factory so that custom validators with dependencies can
simply declare them as normal. Note that you will need to define each custom validator as a service in your
container.

@param ContainerBuilder $containerBuilder
Ensure we are using the container constraint validator factory so that custom validators with dependencies can simply declare them as normal . Note that you will need to define each custom validator as a service in your container .