goaop / goaop-laravel-bridge

Integration bridge for Go! AOP framework and Laravel
MIT License
95 stars 10 forks source link

Annotations are not working #10

Closed i3anaan closed 6 years ago

i3anaan commented 7 years ago

I wanted to make an advice to trigger on annotations, yet am unable to get it to correctly trigger. While first having attempted to create my very own version of the annotation, running into trouble I decided to exactly copy from the example on http://go.aopphp.com/docs/pointcuts-and-advices/

The relevant code can be found here: https://github.com/AEGEE/oms-neo-core/compare/perm-aop...perm-aop-example

Note that I have verified the address() method to be called (using the dump), yet the dd() in the advice does not trigger. Also note that the above advice in PermissionAspect.php does work, precisely targeting the method.

I tried updating to the latest version of the Go! framework to see if that helped, yet this caused another error for me (see #9 )

lisachenko commented 7 years ago

Hi, thank you for reporting this issue! I will try to reproduce your case, probably on my weekends.

i3anaan commented 7 years ago

Hey @lisachenko ,

I managed to fix the problem. First off: I made a stupid copying mistake, I forgot to change @Around("@execution(Annotation\Cacheable)") To @Around("@execution(App\Aspect\Cacheable)") Fixing this made the example work.

Secondly, I found out why my custom first try did not work: I tried to use it with @within(), which apparently did not work. I would say that it could be useful to clarify this somewhere in the documentation. Do you also have the documentation on GitHub? I am willing to shoot in a PR for you about this.

lisachenko commented 7 years ago

Hi, @i3anaan! I'm happy that you managed to fix this issue by yourself )

Do you use my PhpStorm plugin for Go! AOP Framework? It will help you to avoid mistakes in the pointcuts and will provide useful navigation.

All documentation is available on https://github.com/lisachenko/go.aopphp.com (it's old Octopress codegen site), but it works on http://go.aopphp.com. I'm not so cool frontend developer, so if someone could improve the docs, it will receive many 👍 👍 👍 )

lisachenko commented 7 years ago

Pointcuts are described on the page http://go.aopphp.com/docs/pointcut-reference/