Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Sep 30, 2025

@dereuromark dereuromark added this to the 5.2.9 milestone Sep 30, 2025
@ADmad
Copy link
Member

ADmad commented Sep 30, 2025

This is quite hackish, but probably there isn't a better way to handle this.

@dereuromark
Copy link
Member Author

@markstory Might have ideas. Lets see.

@der-dave
Copy link

der-dave commented Oct 1, 2025

Hello everyone!
I reported the issue in the forums, dereuromark made this PR and asked me to add some more information here instead of forums.

The changes in ComponentRegistry are working like described in documentation. :)

dereuromark mentioned it should be simply possible to register the Component like this:
$container->add(OauthComponent::class);

When doing so, I get the following Exception:

Component App\Controller\Component\OauthComponent is registered in container but cannot be resolved.

For now I am registering the Component like the documentation says:
$container->add(OauthComponent::class) ->addArgument(ComponentRegistry::class) ->addArgument(GenericProvider::class);
and its working.

Thank you!

Another problem I noticed is the following (and I dont know if its because of the cahnges in ComponentRegistry:
If Controller and Component have same names like:

OauthController;
OauthComponent;

I got completely weird results and errors saying:

[Cake\ORM\Exception\MissingTableClassException] Table class for alias Oauth could not be found. in /cakephp/src/ORM/Locator/TableLocator.php on line 249
Exception Attributes: array (
0 => ‘for alias Oauth’,
)

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.

@dereuromark dereuromark requested a review from markstory October 2, 2025 12:58

// Merge runtime config into the component
if ($config) {
$instance->setConfig($config);
Copy link
Member

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?

@markstory
Copy link
Member

CI failures seem related.

@dereuromark dereuromark requested a review from markstory October 7, 2025 11:54
@markstory markstory merged commit d0783bf into 5.x Oct 7, 2025
12 of 15 checks passed
@markstory markstory deleted the 5.x-di-components branch October 7, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants