当我尝试请求在奏鸣曲中列出对象时,我收到此错误:
您已请求不存在的服务“”。
这是我的config.yml:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.xml }
framework:
#esi: ~
#translator: { fallback: %locale% }
translator: ~
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_parameters: %kernel.debug%
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
default_locale: %locale%
trust_proxy_headers: false # Should Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
session: ~
# 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
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Sports\UserBundle\Entity\User
registration:
confirmation:
enabled: true
from_email:
address: tirengarfio@gmail.com
sender_name: Javier Garcia
sonata_admin:
title: Sonata Project
title_logo: /bundles/sonataadmin/logo_title.png
这是我的services.xml:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.admin.tag_admin" class="Sonata\DefaultBundle\Admin\TagAdmin">
<tag name="sonata.admin" manager_type="orm" group="Posts" label="Blog"/>
<argument />
<argument>Sonata\DefaultBundle\Admin\TagAdmin</argument>
<argument>SonataAdminBundle:CRUD</argument>
<call method="setTranslationDomain">
<argument>fjaksa</argument>
</call>
</service>
</services>
</container>
答案 0 :(得分:0)
这个错误意味着你没有为当前控制器服务“”(控制器也是空的^ _ ^)
在stackoverflow上搜索示例有十几个例子!!!
也许这项服务可行:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.admin.tag_admin" class="Sonata\DefaultBundle\Admin\TagAdmin">
<tag name="sonata.admin" manager_type="orm" group="Posts" label="Blog"/>
<argument />
<argument>Sonata\DefaultBundle\Admin\TagAdmin</argument>
<argument />
<call method="setTranslationDomain">
<argument>fjaksa</argument>
</call>
</service>