我試圖在我的Symfony Project上安裝SonataAdmin,但在文檔第二部分的末尾,當我試圖繼續「http://localhost:8000/admin/」我有一個錯誤:「您已經申請了一個非-existent服務「admin.category」中(其正在從「C:\ wamp64 \ WWW \奏/應用/配置\ routing.yml中」輸入)。確保有支持「sonata_admin」型裝載機「。SonataAdmin安裝問題
我不知道爲什麼,我給我給我所有的參數的代碼也許它可以幫助你理解我的問題。
參數: #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
在我的routing.yml只有: '應用: 資源: '@的appbundle /控制器/' 類型:註釋 admin_area: 資源: 「@ SonataAdminBundle /資源/配置/路由/ sonata_admin.xml」 前綴:/管理 _sonata_admin: 資源。 類型:sonata_admin 前綴:/ admin ' – jpp28
好吧我誤解了哪個文件與上面的代碼塊相匹配,它是services.yml(在app/config中)對不對?所以你應該削減你的'category.admin'塊並將其粘貼到我提到的文件中,這就是你必須聲明管理類的地方 – KelgMak
是的,它是app/config/service.yml文件。但是我的項目實際上是空的。我只有奏鳴曲,我只是想在真正的項目中使用它之前在空的項目中測試它。我將盡力在一個真實的項目上做到這一點,我們將會看到 – jpp28