2.5. Auto Aspect

You are able to register Aspect with the s2aspect function. In the following example, TraceInterceptor is aspected to the add method of Service class. When Action component is taken out by the get method of S2ApplicationContext and the indexAction method is performed, the trace log at the time of the add method of Service class being performed will be outputted.


s2import(dirname(__FILE__) . '/classes');
s2aspect('new seasar\aop\interceptor\TraceInterceptor')

$action = s2get('Action');

This Example is located at "examples/quickstart/quickstart030.php".

© Copyright The Seasar Foundation and the others 2005-2010, all rights reserved.