简体   繁体   English

奏鸣曲管理员:不存在的服务“security.authorization_checker”

[英]Sonata Admin: non-existent service "security.authorization_checker"

I am trying to set up a simple CMS using Sonata Admin Bundle.我正在尝试使用 Sonata Admin Bundle 设置一个简单的 CMS。 I use composer to add sonata-project/admin-bundle and sonata-project/doctrine-orm-admin-bundle to an empty git repository, then follow the rest of the directions on https://sonata-project.org/bundles/admin/3-x/doc/getting_started/installation.html I use composer to add sonata-project/admin-bundle and sonata-project/doctrine-orm-admin-bundle to an empty git repository, then follow the rest of the directions on https://sonata-project.org/bundles/ admin/3-x/doc/getting_started/installation.html

Now I visit http://localhost/admin/dashboard , which the instructions say should give me a blank dashboard.现在我访问http://localhost/admin/dashboard ,说明应该给我一个空白仪表板。 Instead, I get a ServiceNotFoundException, stating:相反,我得到一个 ServiceNotFoundException,说明:

The service "sonata.admin.menu.group_provider" has a dependency on a non-existent service "security.authorization_checker".服务“sonata.admin.menu.group_provider”依赖于不存在的服务“security.authorization_checker”。

Is there a bundle or configuration that I need to install/add in order to fix this?是否有我需要安装/添加的捆绑包或配置才能解决此问题?

=== ===

When I run bin/console debug:container security.authorization_checker I get the following output:当我运行bin/console debug:container security.authorization_checker时,我得到以下 output:

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:在 CheckExceptionOnInvalidReferenceBehaviorPass.php 第 86 行:

The service "sonata.admin.menu.group_provider" has a dependency on a non-existent service "secur ity.authorization_checker".服务“sonata.admin.menu.group_provider”依赖于不存在的服务“security.authorization_checker”。

=== ===

Here is config/packages/sonata_admin.yaml:这是 config/packages/sonata_admin.yaml:

sonata_block:
  blocks:
    # enable the SonataAdminBundle block
    sonata.admin.block.admin_list:
      contexts: [admin]

... and here is config/services.yaml: ...这里是 config/services.yaml:

parameters:
    locale: 'en'

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/*'
        exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'

    # controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
        resource: '../src/Controller'
        tags: ['controller.service_arguments']

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones

... and here is my bundles.php: ...这是我的捆绑包。php:

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
    Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
    Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
    Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle::class => ['all' => true],
    Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
    Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
    Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
    Sonata\AdminBundle\SonataAdminBundle::class => ['all' => true],
    Sonata\Doctrine\Bridge\Symfony\SonataDoctrineBundle::class => ['all' => true],
    Sonata\Form\Bridge\Symfony\SonataFormBundle::class => ['all' => true],
    Sonata\Twig\Bridge\Symfony\SonataTwigBundle::class => ['all' => true],
];

You need to install symfony security.您需要安装 symfony 安全。 And maybe flex, if you don't already have it.如果你还没有它,也许可以弯曲。

composer require symfony/flex
composer require security

That will automatically install and configure the bundle for you.这将自动为您安装和配置捆绑包。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Symfony2 FOSUserBundle-您已请求一个不存在的服务“ security.user_checker” - Symfony2 FOSUserBundle - You have requested a non-existent service “security.user_checker” Symfony 3 - 在我的服务参数中添加 security.authorization_checker 会导致重定向过多 - Symfony 3 - Add security.authorization_checker in my service 's args cause too many redirects 服务“sonata.block.service.container”依赖于不存在的服务“模板化” - The service “sonata.block.service.container” has a dependency on a non-existent service “templating” 您已请求不存在的服务“security.context” - You have requested a non-existent service “security.context” 服务“ security.context_listener.0”依赖于不存在的服务“ fos_user.user_manager” - The service “security.context_listener.0” has a dependency on a non-existent service “fos_user.user_manager” 服务“ twig”依赖于不存在的服务“ security.context” - The service “twig” has a dependency on a non-existent service “security.context” Symfony 2称不存在的服务“路由器” - Symfony 2 calling non-existent service “router” 服务“ form.type.users”依赖于不存在的服务“ security.context” - The service “form.type.users” has a dependency on a non-existent service “security.context” 您请求了一个不存在的服务“security.access.decision_manager” - You have requested a non-existent service "security.access.decision_manager" 您请求的服务“ user_service”不存在 - You have requested a non-existent service “user_service”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM