Magento

An Introduction to Interception

Created by Daniel Fahlke aka Flyingmana / @Flyingmana

## One Moment please * please stay quite * dont leave your places * listen carefully
* Speaker goes off to take a mate * from off: * one moment * the coins dont want as I want * comes back
## This was an Interception * I took the normal workflow * Injected my action * go back to the workflow

/**
* @After("execution(public \Flyingmana\Talk\MagentoInterception->Slide1(*))")
*/
public function exampleObserver(MethodInvocation $invocation)
{
    \Flyingmana\Talk\Helper::showStayQuiteSlide();
    echo 'one moment';
    echo 'The coins dont want as I want';
    \Flyingmana\Talk\Helper::getBottleClubmate();
}
                        
## Which Interceptions are possible? * Before * After * AfterThrowing * Around * Pointcut (the traditional event hook)
## Annotations vs XML * both should be cached in production * both are parsable * magento does xml * xml has schemas and validation tools * I dont like Annotations
## Now a few Examples
## Now a few Examples * add logging * do specialized profiling (no example here)
## Now a few Examples * Patch code * for example to workaround not fixed bugs

Some Links

THE END