Aspect Oriented Programming (AOP) with Symfoy 2
===

I found this interesting bundle [schmittjoh/JMSAopBundle][1] shipped as requirement for another good one, the [schmittjoh/JMSDiExtraBundle][2]. It's about AOP:

> If you haven't heard of AOP yet, it basically allows you to separate a
> cross-cutting concern (for example, security checks) into a dedicated
> class, and not having to repeat that code in all places where it is
> needed.
> 
> In other words, this allows you to execute custom code before, and
> after the invocation of certain methods in your service layer, or your
> controllers. You can also choose to skip the invocation of the
> original method, or throw exceptions.

My application is multi-tenant, so each entity as a relation with `User` class. An `User` can view and edit only entities that belongs to him. But some special users (read: admins) can view and edit entities owned by other users.

I'd like to implement this idea: a pointcut describing each controller method `edit*($slug)`, `show*($slug)`. And an interceptor that get the entity from the database and check that:

 - Either user has role `ROLE_MGN_NOT_OWNED_ENTITIES`
 - Or the user is the original owner of the entity

In any other case the interceptor should log what happenend and throw an AccessDeniedException.

Question is: is this a good approach to AOP? An if yes, is there any naming convention for pointcuts/interceptors?

  [1]: https://github.com/schmittjoh/JMSAopBundle
  [2]: https://github.com/schmittjoh/JMSDiExtraBundle