-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[5.3] [RFC] CMSPlugin: Lazy subscriber interface and decorator #43658
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
Conversation
This reverts commit 08e5c6d.
|
This pull request has been automatically rebased to 5.3-dev. |
|
I will redo this with Lazy Objects |
|
But we still support earlier versions of PHP don't we? |
|
Would it not make more sense to have the whole DI container to support lazy objects? Like that, the plugins are only instantiated when actually used. |
I doubt this PR will be merged in 1-2 years, we have plenty of time 😄
I need to see a code or an example to say something about it. In theory maybe "yes". |
|
Alternative pr is there: |
Summary of Changes
Adding LazySybscriber interface and decorator.
The decorator
LazyServiceSubscriberallows to instantiate the plugin with heavy dependencies only when the event is actualy dispatched.The interface
LazySubscriberInterfacealso allows to useLazyServiceEventListener, hovewer the plugin should implement it on its own.Example usage of the decorator for the plugin with heavy dependencies:
Code for
plugins/system/example/services/provider.php.Before:
After:
The decorator can work very nicely with (in future):
But I will update it depend what first will be merged this PR or that PR.
Testing Instructions
Code review by maintainers.
Check that following plugins works as before:
Actual result BEFORE applying this Pull Request
Works
Expected result AFTER applying this Pull Request
Works
Link to documentations
Please select:
References: