Skip to content
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: Use of CodeIgniter\Config\Services prevents Service overriding #2381

Merged
merged 1 commit into from
Nov 13, 2019
Merged

Fix: Use of CodeIgniter\Config\Services prevents Service overriding #2381

merged 1 commit into from
Nov 13, 2019

Conversation

dafriend
Copy link
Contributor

@dafriend dafriend commented Nov 2, 2019

Fixes #2376

The following statement is used by multiple "core" classes

 use CodeIgniter\Config\Services;

This results in App\Config\Services being bypassed which prevents Service overrides from being recognized.

All namespace use statements for Services in the core classes changed to use Config\Services; so the overrides can be accomplished.

Note: There are a lot of test files that explicitly use CodeIgniter\Config\Services that were not changed in the PR. They probably don't need to be and/or should not be changed, but I wanted to point that out.

See #2376

The following statement is used by multiple "core" classes

`use CodeIgniter\Config\Services;`

This results in `App\Config\Services` being bypassed.

All namespace use statements for `Services` in the core classes changed to ` use Config\Services;` so the overrides can be accomplished.
@MGatner
Copy link
Member

MGatner commented Nov 13, 2019

I think this is good. I also think we need to define a) what can and can't be extended/overridden, and b) what order of precedence various sections give to App/System/Modules/etc. See also #2355 (comment)

@MGatner MGatner merged commit d27fff2 into codeigniter4:develop Nov 13, 2019
@lonnieezell
Copy link
Member

Yes, those were from around from before some of the extension concepts were solidified. So, yes, perfect. Everything should always extend Config\Services. Thanks.

@dafriend dafriend deleted the Fix_#2376_cannot_override_services branch November 13, 2019 17:19
@dafriend dafriend mentioned this pull request Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Usage of static::methodName in CodeIgniter\Config\Services prevents Service overriding
3 participants