Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony “功能”;是“授予”吗;在SonataAdminBundle中不存在_Symfony_Symfony Sonata - Fatal编程技术网

Symfony “功能”;是“授予”吗;在SonataAdminBundle中不存在

Symfony “功能”;是“授予”吗;在SonataAdminBundle中不存在,symfony,symfony-sonata,Symfony,Symfony Sonata,安装后,当我试图查看管理员/仪表板时,出现以下错误: SonataAdminBundle::standard_layout.html.twig第95行的函数“is_grated”不存在 我也花了很多时间来解决这个问题。以下是修复方法: 将SecurityBundle添加到app/AppKernel.php public function registerBundles() { $bundles = array( // ... // support for

安装后,当我试图查看管理员/仪表板时,出现以下错误:

SonataAdminBundle::standard_layout.html.twig第95行的函数“is_grated”不存在


我也花了很多时间来解决这个问题。以下是修复方法:

将SecurityBundle添加到
app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        // support for the admin
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
    );
    // ...
}
在您的
app/config
文件夹中创建
security.yml
,例如,使用此演示内容:

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext

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

    providers:
        in_memory:
            memory:
                users:
                    user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                    admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            pattern: ^/
            anonymous: ~
            http_basic:

                realm: "Secured Demo Area"
    access_control:
        #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
        #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
并将其加载到您的
app/config/config.yml

imports:
    - { resource: security.yml }

这对我起了作用。

作为对其他可能面临此问题的人的反馈:

acme的解决方案有效。显然,必须按照中所述提供用户


这本应该是对Acme答案的一次投票,可能会有评论。你的帖子不是一个新的答案,我真的很抱歉,但我既不能更新(由于声誉的原因),也不能发表评论。