-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Fix auto-discovering validator constraints #49850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FrameworkBundle] Fix auto-discovering validator constraints #49850
Conversation
fcaf910
to
bb0c3a0
Compare
Indeed, it could be great to use this pattern for internal stuff that doesn't need to be manipulated by the container such as form types, or even to load user land stuff like entities, serializable items, API resources, etc... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is indeed the way to go
A solution for the edge case UniqueEntity
?
As it's in the doctrine bridge and the validator is not a service, this one does not get extraction.
Also: I see that you chose 6.3 branch: does that mean that 6.2 will stay with translation extraction not working as expected?
src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php
Outdated
Show resolved
Hide resolved
See #49785 (comment) |
bcc8dca
to
f9ac1e3
Compare
PR updated to target 6.2
To me, the corresponding validator is a service, so there is nothing to do. |
src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.php
Outdated
Show resolved
Hide resolved
f9ac1e3
to
5a82393
Compare
Reading this PR makes me realize that Including excluded services should be opt-in IMO. And btw, we should keep throwing in case of non-excluded abstract services being tagged as constraint validators, to provide a better DX (which is why the check was used in the first place). Removing this check in your PR in favor of silently skipping them decreases DX. |
5a82393
to
5d84b60
Compare
PR updated, needs #49867 |
… when using `findTaggedServiceIds()` (nicolas-grekas) This PR was merged into the 6.2 branch. Discussion ---------- [DependencyInjection] Filter "container.excluded" services when using `findTaggedServiceIds()` | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - As spotted by `@stof` in #49850 (comment) Commits ------- cf3d67e [DependencyInjection] Filter "container.excluded" services when using `findTaggedServiceIds()`
d84f845
to
c05e655
Compare
c05e655
to
09f7016
Compare
09f7016
to
f60218c
Compare
…olas-grekas) This PR was merged into the 6.2 branch. Discussion ---------- [FrameworkBundle] Fix registering ExpressionValidator | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #49886 | License | MIT | Doc PR | - Introduced in #49850, my bad. Commits ------- e11de1f [FrameworkBundle] Fix registering ExpressionValidator
Alternative to #49785
Note that this kind of container-assisted auto-discovery of non-service classes looks like an interesting pattern for many other subsystems. /cc @symfony/mergers @mtarld