[TYPO3-50-general] understanding the AOP implementation

Robert Lemke robert at typo3.org
Thu Jul 17 11:19:36 CEST 2008

Hi Peter,

Am 17.07.2008 um 11:03 schrieb Peter Niederlag:

> I am still fighting to really understand that AOP stuff.
> running through
> http://flow3.typo3.org/documentation/reference/aop-framework/
> I understand how to define a pointcut or an advice.
> What puzzles me is that the examples for advices at least partly  
> seem to
> base on "plain" pointcut expressions.
> Does that mean the @pointcut annotation solely serves a way to  
> define a
> "named" pointcut?

yes, exactly.

> Within an advice I can either use a named pointcut or a plain
> pointcut-expression?

yes, or combine them if you like.

For example you could define a named pointcut "TypoScriptObjects"  
which matches all classes implementing the TypoScript Interface:

class F3_Peter_SomeAspect {

     * @pointcut within(F3_TypoScript_TypoScriptObjectInterface)
     protected $typoScriptObjects;


Then you want implement an advice which intercepts the render method  
of all TypoScript objects:

  * @around method(.*->render()) && F3_Peter_SomeAspect- 
public function renderAdvice(F3_FLOW3_AOP_JoinPointInterface  
$joinPoint) {
    $originalRenderOutput = $joinPoint->getAdviceChain()- 
    return $originalRenderOutput . ' - Peter was here.';

You see?


More information about the TYPO3-project-5_0-general mailing list