FOSUserBundle:找不到用于安全性:登录的路由 [英] FOSUserBundle : no route found for Security:Login

查看:103
本文介绍了FOSUserBundle:找不到用于安全性:登录的路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前我在这里发布了一个问题:
FOSUserBundle:嵌入登录表单并选择其模板

I post a problem here few days ago : FOSUserBundle: embedding the login form and choosing its template

但是它非常复杂,我认为在这个问题的背后,可能存在一个简单的问题路由,所以我认为创建一个并行主题,删除我所做的所有修改,然后从全新安装开始是个好主意。

But it's pretty complicated, and I think behind this problem, there is maybe a simple problem of route, so I think it's a good idea to create a parallel topic, delete all the modifications I do, and start with fresh new installation.

因此,我安装了FOSUserBundle,我有一个WelcomeBundle,其中包含我网站的几个页面,我还创建了一个新的UserBundle,其中仅包含FOSUserBundle的用户实体,没有其他内容(没有任何替代)。

So, I install FOSUserBundle, I have a WelcomeBundle, which contains the several pages of my website, and I also create a fresh UserBundle, which only contains the User Entity for FOSUserBundle, nothing else (no override of anything).

在我的rsWelcomeBundle的index.html.twig中,我输入了以下简单代码:

In my rsWelcomeBundle, in my index.html.twig, I put this simple code :

{% extends "rsWelcomeBundle::layout.html.twig" %}

{% block title "Page d'accueil" %}

{%  block body %}
    <div class="span6">
        <div class="well">
            <h2>Présentation du jeu</h2>
            <a href="{{ path('rsWelcomeBundle_homepage_inscription') }}" class="btn ">Je m'inscris !</a></p>
        </div>
    </div>
    <div class="span6">
        <div class="well">
            {% render "FOSUserBundle:Security:login" %}
        </div>
    </div>

{% endblock %}

我总是有这个错误:

在rsWelcomeBundle:Homepage:index.html.twig中的模板渲染过程中引发了异常(未找到 GET Security:login的路由)。第1行。

An exception has been thrown during the rendering of a template ("No route found for "GET Security:login"") in rsWelcomeBundle:Homepage:index.html.twig at line 1.

如果我将此行用作渲染部分,则起作用。

If I put this line for the render part it's working.

{% render(controller("FOSUserBundle:Security:login")) %}

但为什么 ??
在文档中我从未见过要使用 render(controller。
为什么我不能直接使用:渲染 FOSUserBundle:Security:login吗?

But why ?? In the documentation I never see we've to use "render(controller". Why I can't use directly : render "FOSUserBundle:Security:login" ?

在app / config / routing.yml中,我有:

In app/config/routing.yml I have :

tuto_welcome:
    resource: "@rsWelcomeBundle/Resources/config/routing.yml"
    prefix:   /

fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"

fos_user_profile:
    resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
    prefix: /profile

fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
    prefix: /register

fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /resetting

fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
    prefix: /profile

在UserBundle中,我没有routing.yml。
在WelcomeBundle中,我在routing.yml中有以下内容:

In the UserBundle I don't have routing.yml. In the WelcomeBundle I have this in routing.yml :

rsWelcomeBundle_homepage:
    pattern:  /
    defaults: { _controller: "rsWelcomeBundle:Homepage:index" }

我尝试了两天要解决此问题,您能帮我吗?

It's been two days I try to fix this problem, could you help me ?

非常感谢大家!

推荐答案

{%render FOSUserBundle:Security:login%} 是Symfony 2.0呈现子请求的方式。 {{render(controller( FOSUserBundle:Security:login))}} 是2.1+的语法。两种语法基本上都表示相同的事物。

{% render "FOSUserBundle:Security:login" %} is the Symfony 2.0 way to render a subrequest. {{ render(controller("FOSUserBundle:Security:login")) }} is the syntax for 2.1+. Both syntax basically mean the same exact thing.

有关子请求的文档位于: http://symfony.com/doc/current/quick_tour/the_view.html#embedding-other-controllers

Documentation about subrequests is here: http://symfony.com/doc/current/quick_tour/the_view.html#embedding-other-controllers

这篇关于FOSUserBundle:找不到用于安全性:登录的路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆