-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
update 3.2->3.3 bc break: decoration of validator.validator_factory service is not working #24222
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
Comments
Can you confirm that the change from #24223 applied on the compiler pass in your code base solves the issue? |
@xabbuh thank you for participating, but, unfortunatelly, that fix does not help. Changing |
The issue is that the AddConstraintValidatorPass is registered as Btw, this can also cause other bugs, because it also runs after optimizations while it is adding new links in the graph, which may forbid some optimizations already applied. |
@stof I am also often register my passes as For example, I have own "autowire" pass, which registers new services in So, maybe we could have |
So, currently I solved the issue by writing custom CompilerPass, which performs decoration on |
@Strate if you add new references after the optimizations, you may break your container entirely due to optimizations being wrong. What you should do is register your "autowire" pass creating new services with a priority higher than 0, so that it runs at the beginning of TYPE_BEFORE_OPTIMIZATION stage. |
@stof default \Symfony\Component\DependencyInjection\Compiler\AutowirePass is registered in TYPE_OPTIMIZE stage, is it okay? Btw, I think we need to document it. |
@fabpot Can you answer @stof's question from #24222 (comment)? :) |
…ations (xabbuh) This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] add constraint validators before optimizations | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24222 | License | MIT | Doc PR | Commits ------- 05e0e16 add constraint validators before optimizations
I do have a decorator service over
validator.validator_factory
, as described in documentation. It is not working for now, because:\Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass
is removing original service, renaming it tomy_service_name.inner
and set alias frommy_service_name
tovalidator.validator_factory
.After that
\Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass
is invoked, and tries to locate original servicevalidator.validator_factory
which can not be found anymore.As a result, validator factory built with wrong dependencies.
The text was updated successfully, but these errors were encountered: