|
214 | 214 | use Symfony\Component\TypeInfo\TypeResolver\TypeResolverInterface;
|
215 | 215 | use Symfony\Component\Uid\Factory\UuidFactory;
|
216 | 216 | use Symfony\Component\Uid\UuidV4;
|
| 217 | +use Symfony\Component\Validator\Attribute\ExtendsValidationFor; |
217 | 218 | use Symfony\Component\Validator\Constraint;
|
218 | 219 | use Symfony\Component\Validator\Constraints\ExpressionLanguageProvider;
|
219 | 220 | use Symfony\Component\Validator\Constraints\Traverse;
|
@@ -1819,10 +1820,16 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
|
1819 | 1820 | if (class_exists(ValidatorAttributeMetadataPass::class) && (!($config['enable_attributes'] ?? false) || !$container->getParameter('kernel.debug'))) {
|
1820 | 1821 | // The $reflector argument hints at where the attribute could be used
|
1821 | 1822 | $container->registerAttributeForAutoconfiguration(Constraint::class, function (ChildDefinition $definition, Constraint $attribute, \ReflectionClass|\ReflectionMethod|\ReflectionProperty $reflector) {
|
1822 |
| - $definition->addTag('validator.attribute_metadata'); |
| 1823 | + $definition->addTag('validator.attribute_metadata') |
| 1824 | + ->addTag('container.excluded', ['source' => 'because it\'s a validator constraint extension']); |
1823 | 1825 | });
|
1824 | 1826 | }
|
1825 | 1827 |
|
| 1828 | + $container->registerAttributeForAutoconfiguration(ExtendsValidationFor::class, function (ChildDefinition $definition, ExtendsValidationFor $attribute) { |
| 1829 | + $definition->addTag('validator.attribute_metadata', ['for' => $attribute->class]) |
| 1830 | + ->addTag('container.excluded', ['source' => 'because it\'s a validator constraint extension']); |
| 1831 | + }); |
| 1832 | + |
1826 | 1833 | if ($config['enable_attributes'] ?? false) {
|
1827 | 1834 | $validatorBuilder->addMethodCall('enableAttributeMapping');
|
1828 | 1835 | }
|
|
0 commit comments