-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Adding BaseService::updateServicesCache. Adds ablity to update Services Cache at runtime. #8896
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
Closed
Closed
feat: Adding BaseService::updateServicesCache. Adds ablity to update Services Cache at runtime. #8896
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
864cf17
feat: Adding BaseService::updateServicesCache refreshes and looks for…
pyromanci 9b8f801
chore: added comments to the test classes for BaseService::updateServ…
pyromanci 21f25ca
fix: Added missing class to codeigniter.additionalServices for testing.
pyromanci 56f1ed0
fix: Forgot to update the exlude list from the fork rest.
pyromanci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/_support/Test/AfterAutoloadModule/Config/Services.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of CodeIgniter 4 framework. | ||
* | ||
* (c) CodeIgniter Foundation <admin@codeigniter.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AfterAutoloadModule\Config; | ||
|
||
use AfterAutoloadModule\Test; | ||
use CodeIgniter\Config\BaseService; | ||
|
||
/** | ||
* Services for testing BaseService::updateServicesCache() | ||
* | ||
* This class should not be discovered by the autoloader until the test adds this namespace to the autoloader. | ||
*/ | ||
class Services extends BaseService | ||
{ | ||
/** | ||
* Return a shared instance of the Test class for testing | ||
*/ | ||
public static function test(bool $getShared = true): Test | ||
{ | ||
if ($getShared) { | ||
return static::getSharedInstance('test'); | ||
} | ||
|
||
return new Test(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of CodeIgniter 4 framework. | ||
* | ||
* (c) CodeIgniter Foundation <admin@codeigniter.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AfterAutoloadModule; | ||
|
||
/** | ||
* A simple class for testing BaseService::updateServicesCache() | ||
* | ||
* This class should not be discovered by the autoloader until the test adds this namespace to the autoloader. | ||
*/ | ||
class Test | ||
{ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -171,3 +171,6 @@ would simply use the framework's ``Config\Services`` class to grab your service: | |||||||||||||||||||||||||||||
.. literalinclude:: services/012.php | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
.. note:: If multiple Services files have the same method name, the first one found will be the instance returned. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
There may be times when you need to have Service Discovery refresh it's cache after the inital autoload proccess. This can be done by running :php:meth:`Config\\Services::updateServicesCache()`. | ||||||||||||||||||||||||||||||
This will force the service discovery to re-scan the directories for any new services files. | ||||||||||||||||||||||||||||||
Comment on lines
+175
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this?
Suggested change
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.