Symfony 2.7 使用RegistrationController::registerAction()覆盖FousBundle时出错

Symfony 2.7 使用RegistrationController::registerAction()覆盖FousBundle时出错,symfony-2.7,Symfony 2.7,我试图从FOUserBundle重写RegistrationController,但是。有这个错误 注意:Arquitectura\BaseBundle\Controller\RegistrationController::registerAction()的声明应与FOS\UserBundle\Controller\RegistrationController::registerAction()的声明兼容 当chance和put使用请求参数时,删除缓存,并给出该错误 找不到“GET/regist

我试图从FOUserBundle重写RegistrationController,但是。有这个错误

注意:Arquitectura\BaseBundle\Controller\RegistrationController::registerAction()的声明应与FOS\UserBundle\Controller\RegistrationController::registerAction()的声明兼容

当chance和put使用请求参数时,删除缓存,并给出该错误

找不到“GET/register/”的路由。我使用Symfony 2.7.23

这是我的新注册控制器类

namespace Arquitectura\BaseBundle\Controller;

use Symfony\Component\HttpFoundation\RedirectResponse;
#use Symfony\Component\HttpFoundation\Request;
use FOS\UserBundle\Controller\RegistrationController as BaseController;

class RegistrationController extends BaseController
{

    public function registerAction(\Symfony\Component\HttpFoundation\Request $request) {


        parent::registerAction($request);

        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->container->get('fos_user.registration.form.factory');
        /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
        $userManager = $this->container->get('fos_user.user_manager');
        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->container->get('event_dispatcher');

        $user = $userManager->createUser();
        $user->setEnabled(true);

        $dispatcher->dispatch(FOSUserEvents::REGISTRATION_INITIALIZE, new UserEvent($user, $request));

        $form = $formFactory->createForm();
        $form->setData($user);

        if ('POST' === $request->getMethod()) {
            $form->bind($request);

            if ($form->isValid()) {
                $event = new FormEvent($form, $request);
                $dispatcher->dispatch(FOSUserEvents::REGISTRATION_SUCCESS, $event);

                $userManager->updateUser($user);

                if (null === $response = $event->getResponse()) {
                    $url = $this->container->get('router')->generate('fos_user_registration_confirmed');
                    $response = new RedirectResponse($url);
                }

                $dispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($user, $request, $response));

                return $response;
            }
        }

        return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.'.$this->getEngine(), array(
            'form' => $form->createView(),
        ));
    }

}

我必须在路由上放些东西???

我知道是什么错误了。只需说,而不是。稍后发送一个错误,如

试图从命名空间“Arquitectura\BaseBundle\Controller”加载类“FOSUserEvents”。 您是否忘记了“FOS\UserBundle\FOSUserEvents”的“use”语句

我只是把台词加起来

use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\Event\GetResponseUserEvent;
use FOS\UserBundle\Event\UserEvent;
use FOS\UserBundle\Event\FilterUserResponseEvent;
和工作