/** * "Before" advice which tries to alter the passed parameters * * @param \AppserverIo\Psr\MetaobjectProtocol\Aop\MethodInvocationInterface $methodInvocation Initially invoked method * * @return null * * @Before */ public function parametersAlteringBeforeAdvice(MethodInvocationInterface $methodInvocation) { $methodInvocation->setParameters(array(new \stdClass(), 'parametersAlteringBeforeAdvice')); }
/** * Basic Before advice incrementing the param of the wrapped methods. * Will reference two pointcuts * * @param \AppserverIo\Psr\MetaobjectProtocol\Aop\MethodInvocationInterface $methodInvocation Initially invoked method * * @return void * * @Before("pointcut(PointcutReferencingIHaveASimpleBeforeAdvice1, PointcutReferencingIHaveASimpleBeforeAdvice2)") */ public static function paramIncrementingSeveralPointcutsAdvice(MethodInvocationInterface $methodInvocation) { $param = $methodInvocation->getParameters()['param']; $param++; $methodInvocation->setParameters(array('param' => $param)); }