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

Load Rules lazyly #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Load Rules lazyly #70

wants to merge 4 commits into from

Conversation

melicerte
Copy link

Use proxy manager to proxify Rules.

Rules should not be loaded with all dependent services at each start of the application.
Who knows how many services are injected by Rules ?
Instead, set each Rule as a lazy service.

BUT, the downside is that I put on and after functions as static to be able to get events without initialize the Rule object.
So it comes with less flexibility, as you cannot define complex behaviour in on and after functions.
Oh, and it breaks compatibility, obviously.

Another (better ?) idea would be to split detection and execution in 2 classes.
One Rule with on or/and after function and on Handler with one function handle which will execute what needs to be executed.
And only the Handler would be set as lazy.
BUT, the downside is that one would have to implement two classes instead of one ...

@melicerte melicerte requested a review from Nek- January 20, 2020 08:17
@melicerte
Copy link
Author

@Nek- What do you think about merging this PR ?

@Nek-
Copy link
Contributor

Nek- commented Mar 10, 2020

First we need to fix that: #73

composer.json Show resolved Hide resolved
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.

2 participants