Symfony 2 |奏鸣曲| user-bundle:route“admin_sonata_user_user_create”不存在

时间:2014-09-13 23:26:41

标签: symfony sonata-admin sonata-user-bundle

我关注了Sonata用户捆绑tuto: http://sonata-project.org/bundles/user/2-2/doc/reference/installation.html

一切正常,我得到了我的Application \ Sonata \ UserBundle。 我创建了一个超级管理员用户,我登录管理员/仪表板,我收到此错误:

    An exception has been thrown during the rendering of a template ("Unable to generate a URL for
    the named route "admin_sonata_user_user_create" as such route does not exist.") in 
    SonataAdminBundle:Block:block_admin_list.html.twig at line 38.

几个月前我已经安装了Sonata,我从来没有收到过这个错误,我不知道哪里失败了,我找不到解决方案。

这是我的config.yml:

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }

framework:
    #esi:             ~
    #translator:      { fallback: "%locale%" }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # handler_id set to null will use default session handler from php.ini
        handler_id:  ~
    fragments:       ~
    http_method_override: true

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

# Doctrine Configuration
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: "%kernel.root_dir%/data/data.db3"
        # path:     "%database_path%"
        types:
            json: Sonata\Doctrine\Types\JsonType
    orm:
        entity_managers:
            default:
                mappings:
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~
                    FOSUserBundle: ~

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }

sonata_intl:
    timezone:
        default: Europe/Paris
        detectors:
            - sonata.intl.timezone_detector.user
            - sonata.intl.timezone_detector.locale
        locales:
            fr:    Europe/Paris
            en_UK: Europe/London

sonata_user:
    security_acl: true
    manager_type: orm # can be orm or mongodb

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.admin.block.admin_list:
            contexts:   [admin]
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
        sonata.admin.block.search_result:
            contexts: [admin]

# app/config/security.yml
security:
    # [...]
    acl:
        connection: default

fos_user:
    db_driver:      orm # can be orm or odm
    firewall_name:  main
    user_class:     Application\Sonata\UserBundle\Entity\User


    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager

    service:
        user_manager: sonata.user.orm.user_manager

如果你知道这个问题可能在哪里(配置,安装等)。 TY非常多;)

1 个答案:

答案 0 :(得分:16)

来自https://sonata-project.org/bundles/admin/3-x/doc/getting_started/installation.html的文件:

尝试将以下代码放在routing.yml文件中

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