On Fri, 24 Aug 2012 19:18:40 +0200, Anthony Ferrara <ircmax...@gmail.com>
wrote:
Just a pedantic note here. You don't need any special functionality to do
AOP style programming in PHP. In fact, this use-case is the exact
definition of a Decorator.
Instead of hooking in with a function call and cut-points, you would just
decorate the object you want to interact with, and you're set. Then just
add your functionality where it's needed.
I think you're missing the fundamental difference between decorators and
AOP or interceptors. Decorators augment the object with domain-specific
additions, while interceptors are more appropriate for orthogonal concerns.
CDI (JSR 299/346) has both. Their interceptors are slightly different from
traditional AOP in that you don't have the usual pointcut syntax, and
decoration is done is done automatically upon injection. You might want to
take a look nevertheless; this is the weld (CDI reference implementation)
documentation:
* http://docs.jboss.org/weld/reference/latest/en-US/html/interceptors.html
* http://docs.jboss.org/weld/reference/latest/en-US/html/decorators.html
--
Gustavo Lopes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php