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

Add custom dependency injection logic for aspects #37

Open
WalterWoshid opened this issue Sep 10, 2023 · 5 comments
Open

Add custom dependency injection logic for aspects #37

WalterWoshid opened this issue Sep 10, 2023 · 5 comments
Labels
enhancement 🎆 New feature or request

Comments

@WalterWoshid
Copy link
Contributor

Maybe a protected method in the kernel that allows to add custom logic for dependency injection when instantiating new aspects

@WalterWoshid WalterWoshid added the enhancement 🎆 New feature or request label Sep 10, 2023
@WalterWoshid
Copy link
Contributor Author

Also see #9 (comment)

@WalterWoshid
Copy link
Contributor Author

WalterWoshid commented Sep 16, 2023

  • Make sure that aspects are instantiated when needed, this could be done by adding an instruction to the constructor in the woven class

@WalterWoshid
Copy link
Contributor Author

Done: #67

@WalterWoshid
Copy link
Contributor Author

Hi @jakublabno, I believe this is a feature you wanted, check out PHP-AOP: 1.2.8 :)

This is not yet documented, but the only thing you have to do is extend the dependencyInjectionHandler method in your AopKernel and pass in a Closure which accepts a class-string of the Aspect and should return an instance of that Aspect.

You can also look at the CustomDependencyInjectionHandler test for a better example!

@WalterWoshid
Copy link
Contributor Author

Reopened due to: #37 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎆 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant