【发布时间】:2017-11-16 13:13:53
【问题描述】:
我试图在我的 Symfony 项目上安装 SonataAdmin,但在文档的第 2 部分结束时,当我尝试继续“http://localhost:8000/admin/”时出现错误:“您已请求. 中不存在的服务“admin.category”(从“C:\wamp64\www\Sonata/app/config\routing.yml”导入)。确保有支持“sonata_admin”类型的加载程序。 "
我不知道为什么,我给出了我所有的参数代码,也许它可以帮助你理解我的问题。
参数: #parameter_name:值
服务:
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: false
admin.category:
class: AppBundle\Admin\CategoryAdmin
arguments: [~, AppBundle\Entity\Category, ~]
tags:
- { name: sonata.admin, manager_type: orm, label: Category }
# makes classes in src/AppBundle available to be used as services
# this creates a service per class whose id is the fully-qualified class name
AppBundle\:
resource: '../../src/AppBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
AppBundle\Controller\:
resource: '../../src/AppBundle/Controller'
public: true
tags: ['controller.service_arguments']
# add more services, or override services that need manual wiring
# AppBundle\Service\ExampleService:
# arguments:
# $someArgument: 'some_value'
`
缩进出错了我给你加一张这个文件的图片。 Service code
【问题讨论】:
标签: symfony sonata-admin symfony-sonata symfony-3.2