找不到" GET / login /"的路线在symfony

时间:2017-01-02 02:44:39

标签: symfony routing

我使用symfony 3.2。,安装包 fos_user ,配置它,一切都很顺利。但后来我改变了控制器添加到它的另一种方式。然后,尝试转到地址/登录时收到错误:找不到" GET / login /" 的路由并将某些内容重定向到/ login /

我试图在之前的状态下返回Aktion,清理缓存,缓存目录被完全删除,但没有任何帮助,错误仍然保持不变:找不到" GET /的路由登录/"

我的控制器:

# src/AppBundle/Controller/DefaultController
# Its work.

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class DefaultController extends Controller
{
    /**
    * @Route("/{category}/", name="category")
    */
    public function categoryAction($category)
    {
        return new Response('ok');
    }
}

我的路线:

#app/config/routing.yml

app:
resource: "@AppBundle/Controller/"
type:     annotation

admin:
    resource:
'@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

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

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

我的安全:

#app/config/security.yml

security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       [ROLE_USER, ROLE_SONATA_ADMIN]
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager

            logout:       true
            anonymous:    true

    access_control:
            - { path: ^/login$,     role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/register,   role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/resetting,  role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/admin/,     role: ROLE_ADMIN }
            - { path: ^/,           role: IS_AUTHENTICATED_ANONYMOUSLY }

我很生气,泥巴。

0 个答案:

没有答案