1

我正在使用 symfony2.3.​​X 和 Sonata 管理包和 fos 用户包。通过提供的文档,所有安装均已成功完成。但是当我扩展奏鸣曲用户配置文件并想要编辑然后显示错误:

None of the chained routers were able to generate route: Route 'sonata_user_profile_visit' not found 

我不知道为什么?这是第三方捆绑包版本稳定性问题?还是我的配置问题?

作曲家.json

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony-cmf/routing-bundle": "1.1.*@dev",
    "symfony-cmf/routing": "1.1.*@dev",

    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "doctrine/doctrine-migrations-bundle": "dev-master",
    "doctrine/migrations": "dev-master",
    "doctrine/doctrine-fixtures-bundle": "2.1.*@dev",
    "doctrine/data-fixtures": "1.0.*@dev",

    "twig/extensions": "1.0.*",
    "twig/twig": "~1.12",

    "jms/security-extra-bundle": "~1.5",
    "jms/di-extra-bundle": "~1.4",

    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",

    "knplabs/gaufrette": "0.1.4",
    "knplabs/knp-menu-bundle": "1.1.x-dev",
    "knplabs/knp-markdown-bundle": "1.2.*@dev",

    "sonata-project/easy-extends-bundle": "~2.1",
    "sonata-project/seo-bundle": "~1",
    "sonata-project/doctrine-extensions": "~1",
    "sonata-project/intl-bundle": "~2.1",
    "sonata-project/doctrine-orm-admin-bundle": "2.2.*@dev",
    "sonata-project/notification-bundle": "~2.2",
    "sonata-project/block-bundle": "~2.2",
    "sonata-project/media-bundle": "2.2.*@dev",
    "sonata-project/user-bundle": "2.2.*@dev",
    "sonata-project/cache-bundle": "~2.1",
    "sonata-project/page-bundle": "~2.3",
    "sonata-project/formatter-bundle": "~2.3",
    "sonata-project/news-bundle": "~2.3",

    "friendsofsymfony/facebook-bundle": "*",
    "friendsofsymfony/user-bundle": "1.3.*",

    "dflydev/markdown": "~1.0",
    "simplethings/entity-audit-bundle": "~0.5",
    "willdurand/faker-bundle": "~1.0",

    "incenteev/composer-parameter-handler": "~2.0",
    "sonata-project/admin-bundle": "master"
},

路由.yml

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

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

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: /{username}

fos_user_group:
    resource: "@FOSUserBundle/Resources/config/routing/group.xml"
    prefix: /group    

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

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

soanata_user:
    resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
    prefix: /admin

soanata_user:
    resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
    prefix: /admin

配置文件控制器

<?php

namespace XXX\UserBundle\Controller;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Sonata\UserBundle\Controller\ProfileController as BaseController; 
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\UserBundle\FOSUserEvents;

class ProfileController extends BaseController
{
    public function editAction()
    {
      return parent::editAction();
    }
}
4

1 回答 1

1

你有一个错字soanata_user。您是否完成了SonataUserBundle 配置中列出的步骤?尤其是接近尾声的路由配置。

于 2013-08-27T19:19:27.163 回答