title: Symfony2 Overriding Controllers
body: <p>I use the FOSUserBundle and I want to override his registerAction controller.
  I read the documentation related to overriding controllers of FOSUserBundle but it doesn't work. By echoing a little message in the controller, it is not print in the template.</p>
  
  <p>Here is the way I chose :</p>
  
  <p>I inherit my bundle from FOSUserBundle :</p>
  
  <pre class="lang-php prettyprint-override"><code>namespace Jheberg\MembersBundle;
  
  use Symfony\Component\HttpKernel\Bundle\Bundle;
  
  class JhebergMembersBundle extends Bundle
  {
      public function getParent()
      {
          return 'FOSUserBundle';
      }
  }
  </code></pre>
  
  <p>And I override registerAction in the file named <code>RegistrationController.php</code> in the controller directory of my bundle :</p>
  
  <pre class="lang-php prettyprint-override"><code>namespace Jheberg\MembersBundle\Controller;
  
  use FOS\UserBundle\Controller\RegistrationController as BaseController;
  
  class RegistrationController extends BaseController
  {
      public function registerAction()
      {
          echo 'foo';
          $response = parent::registerAction();
  
          // do custom stuff
  
          return $response;
      }
  }
  </code></pre>
  
  <p>Have you got any solution ?</p>