Add custom dependency injection logic for aspects
Maybe a protected method in the kernel that allows to add custom logic for dependency injection when instantiating new aspects
Also see https://github.com/okapi-web/php-aop/issues/9#issuecomment-1662251236
- [ ] Make sure that aspects are instantiated when needed, this could be done by adding an instruction to the constructor in the woven class
Done: https://github.com/okapi-web/php-aop/pull/67
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!
Reopened due to: https://github.com/okapi-web/php-aop/issues/37#issuecomment-1722263089