As adviced during the SymfonyLive hackday, look at the way the Symfony2Extension does it