简体   繁体   English

Sonata Propel管理员-找不到服务

[英]Sonata Propel Admin - Can't Find Service

I am trying to install and use the Sonata Admin Propel Package. 我正在尝试安装和使用Sonata Admin Propel软件包。
After basic setup it works, I can see the admin dashboard. 完成基本设置后,我可以看到管理控制台。
But when I try to define an admin service for a model I get a The service "sonata.admin.portfolio" has a dependency on a non-existent service "sonata.admin.manager.propel" error, which is true as I can't see it in the loaded services ( using php app/console container:debug ). 但是,当我尝试为模型定义管理服务时,会得到The service "sonata.admin.portfolio" has a dependency on a non-existent service "sonata.admin.manager.propel"错误The service "sonata.admin.portfolio" has a dependency on a non-existent service "sonata.admin.manager.propel" ,这是我可以做到的。在加载的服务中看不到它( using php app/console container:debug )。

I installed it using composer;  
"require": {
    "propel/propel-bundle": "1.4.*",
    "sonata-project/propel-admin-bundle": "dev-master"
},

Registered it in AppKernel.php; 在AppKernel.php中注册;

$bundles = array(
        new Propel\PropelBundle\PropelBundle(),
        // sonanta admin
        new Sonata\CoreBundle\SonataCoreBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Sonata\AdminBundle\SonataAdminBundle(),
);

My admin class for the model uses Sonata\\PropelAdminBundle\\Admin\\Admin and is defined in admin.yml like; 我的模型管理类使用Sonata\\PropelAdminBundle\\Admin\\Admin并在admin.yml中定义;例如:

services:
    sonata.admin.portfolio:
        class: Foo\CoreBundle\Admin\PortfolioAdmin
        tags:
            - { name: sonata.admin, manager_type: propel, group: "Content", label: "Portfolio" }
        arguments:
            - ~
            - Foo\CoreBundle\Model\Portfolio
            - FooCoreBundle:PortfolioAdmin
        calls:
            - [ setTranslationDomain, [FooCoreBundle]]

What have I missed? 我错过了什么?

Just a tiny mistake! 只是一个小错误! You enabled the PropelBundle as necessary for the Propel ORM, but you did not enable the SonataPropelAdminBundle which integrates Propel with Sonata Admin. PropelBundle为Propel ORM启用了SonataPropelAdminBundle ,但未启用将Propel与Sonata Admin集成的SonataPropelAdminBundle

To do so, add this line to your AppKernel.php : 为此,请将此行添加到您的AppKernel.php

new Sonata\PropelAdminBundle\SonataPropelAdminBundle(),

Here are the installation instructions for Propel Admin 这是Propel Admin的安装说明

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM