You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When add the annotation @Assert\DisableAutoMapping(), the Validator component try to find the DisableAutoMappingValidator class, but it doesn't exists. Then you have a 500 error.
How to reproduce
In validator.yaml, under farmework -> validation, add:
#auto_mapping:
# App\Entity\: []
Then, in an entity add the special @Assert\DisableAutoMapping(). On the next validation, the Validator try to find the DisableAutoMappingValidator and fail.
Possible Solution
At the moment in my case, I've just create the Validator with a return in the validate method. Because, the Assert is not use as a Validator by the Validator component. But, this is apparently the Bridge/Doctrine/Validator/DoctrineLoader that take care of this annotations.
Constraint validator "Symfony\Component\Validator\Constraints\DisableAutoMappingValidator" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "Symfony\Component\Validator\Constraints\DisableAutoMapping".
The text was updated successfully, but these errors were encountered:
…idated (ogizanagi)
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Validator] Fix auto-mapping constraints should not be validated
| Q | A
| ------------- | ---
| Branch? | 4.4 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | #34672 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | N/A
As for `Traverse`, I don't think we should add these "constraints" to the list.
I'm also wondering if it really makes sense to have these annotations as constraints. I think it should rather behave like the `GroupSequence` annotation to add the info the generic metadata at loading time, but we don't need to rely on the constraints behavior at all.
Commits
-------
bc53e4b [Validator] Fix auto-mapping constraints should not be validated
Symfony version(s) affected: 4.4.0
Description
When add the annotation
@Assert\DisableAutoMapping()
, the Validator component try to find theDisableAutoMappingValidator
class, but it doesn't exists. Then you have a 500 error.How to reproduce
In validator.yaml, under farmework -> validation, add:
Then, in an entity add the special
@Assert\DisableAutoMapping()
. On the next validation, the Validator try to find theDisableAutoMappingValidator
and fail.Possible Solution
At the moment in my case, I've just create the Validator with a return in the validate method. Because, the Assert is not use as a Validator by the Validator component. But, this is apparently the
Bridge/Doctrine/Validator/DoctrineLoader
that take care of this annotations.But there is maybe a better solution ? Else, I've a PR (https://github.com/mpiot/symfony/tree/auto_mapping)
Additional context
The text was updated successfully, but these errors were encountered: