Description
Symfony version(s) affected
6.4.0
Description
We have entities where all the validation constraints have been converted to attributes, however symfony validator still complains about using validation constraints through annotations. This is because logic for detecting these is oversimplified and it throws deprecation whenever it detects any attributes
symfony/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php
Lines 120 to 122 in e3e3d5f
Situation is made worse by being unable to disable annotations while having attributes on. Following config
framework:
validation:
enable_annotations: false
enable_attributes: true
produces compilation error The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.
How to reproduce
Run validation in SF fullstack on following object
/** @\ApiPlatform\Core\Annotation\ApiResource()) */
#[\Doctrine\ORM\MappingORM\Entity]
class ThirdParty {}
Possible Solution
Allow turning off enable_annotations
while having enable_attributes
on, or improve deprecation detection so it complains only if it finds annotation Constraint
Additional Context
No response