如何覆盖fos_user_resetting_reset路由

时间:2018-09-24 12:50:22

标签: php symfony symfony-3.4

我在路由文件中:

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

admin:
    resource: "@AdminBundle/Controller/"
    type:     annotation
    prefix:   /admin/

然后我创建控制器:

namespace AdminBundle\Controller;


use FOS\UserBundle\Controller\ResettingController as FOSResettingController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use FOS\UserBundle\Event\GetResponseUserEvent;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use Symfony\Component\Translation\TranslatorInterface;

/**
  * @Route("/resetting")
*/ 
class ResettingController extends FOSResettingController
{
/**
 * @Route("/reset/{token}",
 *     name="fos_user_resetting_reset",
 *     options={"expose": true}
 *     )
 */
public function resetAction(Request $request, $token)
{
    /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
    $formFactory = $this->container->get('fos_user.resetting.form.factory');
    die();
}

通常,当我呼叫/resetting/reset/QEvcFAfoC3Kpta0NfVIMavnNyDVeux-UtUDUejsYnrI时,应使用我创建的这个新动作,但会收到错误消息:No route found for "GET /resetting/reset/QEvcFAfoC3Kpta0NfVIMavnNyDVeux-UtUDUejsYnrI"。 请帮助我。

0 个答案:

没有答案