我是很新,Symfony的,而我試圖創建從數據庫中的用戶登錄表單。的Symfony2:路線「login_check」不存在
到目前爲止,我知道我必須把我的login_check防火牆後面,而不是創建一個控制器爲它,但我仍然得到這個錯誤:
An exception has been thrown during the rendering of a template ("Route "login_check" does not exist.") in EventBundle:Security:login.html.twig at line 11.
我security.yml:
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
SocialGeo\EventBundle\Entity\User:
algorithm: sha512
encode-as-base64: true
iterations: 10
role_hierarchy:
ROLE_USER: ROLE_USER
ROLE_DISTRICTWORKER: ROLE_USER
ROLE_CITYWORKER: ROLE_DISTRICTWORKER
ROLE_ADMIN: ROLE_CITYWORKER
ROLE_SUPERADMIN: ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH
providers:
administrators:
entity: { class: SocialGeo\EventBundle\Entity\User, property: username }
firewalls:
main:
pattern: /.*
form_login:
login_path: /login
check_path: /login_check
remember_me: true
logout:
path: /logout
target:/
security: true
anonymous: true
的routing.yml:
EventBundle_login:
pattern: /login
defaults: { _controller: EventBundle:Security:login }
requirements:
_method: GET|POST
EventBundle_login_check:
pattern: /login_check
EventBundle_logout:
pattern: /logout
我的樹枝templa te:
{% extends 'EventBundle::layout.html.twig' %}
{% block title %}Login{% endblock %}
{% block body %}
{% if error %}
<div>{{ error.message }}</div>
{% endif %}
<form action="{{ path('login_check') }}" method="post">
<label for="username">Username</label>
<input id="username" type="text" name="_username" value="{{ last_username }}" />
<label for="password">Password</label>
<input id="password" type="password" name="_password" />
<input type="submit" name="login" />
</form>
{% endblock %}
有誰知道我爲什麼會得到這個錯誤?