title: FOSUserBundle override action of a controller
body: <p>I'm trying to override the editAction in ProfileController.php but it's doesn't work. I can override template and form with success but not the actions of controllers.</p>
  
  <h3>app/config.yml</h3>
  
  <pre><code># FOS UserBundle Configuration
  fos_user:
      db_driver: orm
      firewall_name: main
      user_class: Intranet\UserBundle\Entity\User
      registration:
          form:
              type: intranet_user_registration
      profile:
          form:
              type: intranet_user_profile
  </code></pre>
  
  <h3>old src/Intranet/UserBundle/Controller/ProfileController.php</h3>
  
  <pre><code>&lt;?php
  
  namespace Intranet\UserBundle\Controller;
  
  use FOS\UserBundle\Controller\ProfileController as BaseController;
  
  class ProfileController extends BaseController
  {
      /**
       * Edit the user
       */
      public function editAction(Request $request)
      {
          var_dump($request) die(); // just for the test
      }
  }
  </code></pre>
  
  <h3>new src/Intranet/UserBundle/Controller/ProfileController.php</h3>
  
  <pre><code>&lt;?php
  
  namespace Intranet\UserBundle\Controller;
  
  use FOS\UserBundle\Controller\ProfileController as BaseController;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\Security\Core\Exception\AccessDeniedException;
  
  class ProfileController extends BaseController
  {
      public function editAction(Request $request)
      {
          $user = $this-&gt;container-&gt;get('security.context')-&gt;getToken()-&gt;getUser();
          if (!is_object($user) || !$user instanceof UserInterface) {
              throw new AccessDeniedException('This user does not have access to this section.');
          }
  
          /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
          $dispatcher = $this-&gt;container-&gt;get('event_dispatcher');
  
          $event = new GetResponseUserEvent($user, $request);
          $dispatcher-&gt;dispatch(FOSUserEvents::PROFILE_EDIT_INITIALIZE, $event);
  
          if (null !== $event-&gt;getResponse()) {
              return $event-&gt;getResponse();
          }
  
          /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
          $formFactory = $this-&gt;container-&gt;get('fos_user.profile.form.factory');
  
          $form = $formFactory-&gt;createForm();
          $form-&gt;setData($user);
  
          if ('POST' === $request-&gt;getMethod()) {
              $form-&gt;bind($request);
  
              if ($form-&gt;isValid()) {
                  /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
                  $userManager = $this-&gt;container-&gt;get('fos_user.user_manager');
  
                  $event = new FormEvent($form, $request);
                  $dispatcher-&gt;dispatch(FOSUserEvents::PROFILE_EDIT_SUCCESS, $event);
  
                  $userManager-&gt;updateUser($user);
  
                  if (null === $response = $event-&gt;getResponse()) {
                      $url = $this-&gt;container-&gt;get('router')-&gt;generate('fos_user_profile_show');
                      $response = new RedirectResponse($url);
                  }
  
                  $dispatcher-&gt;dispatch(FOSUserEvents::PROFILE_EDIT_COMPLETED, new FilterUserResponseEvent($user, $request, $response));
  
                  return $response;
              }
          }
  
          return $this-&gt;container-&gt;get('templating')-&gt;renderResponse(
              'FOSUserBundle:Profile:edit.html.'.$this-&gt;container-&gt;getParameter('fos_user.template.engine'),
              array('form' =&gt; $form-&gt;createView())
          );
      }
  }
  </code></pre>
  
  <h3>src/Intranet/UserBundle/IntranetUserBundle.php</h3>
  
  <pre><code>&lt;?php
  
  namespace Intranet\UserBundle;
  
  use Symfony\Component\HttpKernel\Bundle\Bundle;
  
  class IntranetUserBundle extends Bundle
  {
      public function getParent()
      {
          return 'FOSUserBundle';
      }
  }
  </code></pre>
  
  <p>No error message, SF2 ignore my override :/</p>