Closed rafaelqueiroz closed 5 years ago
Hi, @rafaelqueiroz! This is known limitation of framework. If class is loaded before AOP kernel, then aspects won't be applied to it in run-time. This is why you need to find a place where you can init AOP kernel first. For example, you can use composer include file feature to always include initialization logic for your packet.
This issue will be closed because of current framework implementation. If you have any questions, you can open a new issue then.
Hi guys,
I have problem when in the codebase have a instance of object called before init the AspectKernel. I wrote a test for check if aspect to GuzzleHttp\Client() works:
On the happy way, the perfect scenery, works well:
The problem happens if I added the line before init:
Now, the test is broken:
The problem is: I wrote a package which can be included on CakePHP, Laravel (in this case is Laravel), whatever framework.
Each framework has a place for bootstrap the package (such as /config/boostrap.php or AppServiceProvider.php)
Also the framework load and run the core codebase before. Which can create a instance of object anytime.
It's possible the AspectKernel->init() works if have a instance of objects before ?
Thanks in advance.