-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix up DI for components. #18938
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
Fix up DI for components. #18938
Conversation
|
This is quite hackish, but probably there isn't a better way to handle this. |
|
@markstory Might have ideas. Lets see. |
|
Hello everyone! The changes in ComponentRegistry are working like described in documentation. :) dereuromark mentioned it should be simply possible to register the Component like this: When doing so, I get the following Exception:
For now I am registering the Component like the documentation says: Thank you!Another problem I noticed is the following (and I dont know if its because of the cahnges in ComponentRegistry:
I got completely weird results and errors saying:
Its weired because I am not using TableLocator anywhere in OauthController or OauthComponent. For now I fixed it changing name of OauthController to something different. |
src/Controller/ComponentRegistry.php
Outdated
|
|
||
| // Merge runtime config into the component | ||
| if ($config) { | ||
| $instance->setConfig($config); |
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.
This and shared instances are going to be unpleasant. Should we have doc comment content about this edge case?
|
CI failures seem related. |
Tackles
https://discourse.cakephp.org/t/cakephp-5-dependency-injection-inject-existing-service-into-component/12721/1