Sonata Propel Admin - 找不到服务

时间:2014-10-21 13:28:43

标签: php symfony propel sonata-admin symfony-sonata

我正在尝试安装和使用Sonata Admin Propel Package 基本设置完成后,我可以看到管理仪表板 但是,当我尝试为模型定义管理服务时,我收到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"
},

在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(),
);

我的模型的管理类使用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]]

我错过了什么?

1 个答案:

答案 0 :(得分:0)

只是一个小错误!您已根据需要为Propel ORM启用了PropelBundle,但未启用将Propel与Sonata Admin集成的SonataPropelAdminBundle

为此,请将此行添加到AppKernel.php

new Sonata\PropelAdminBundle\SonataPropelAdminBundle(),

Here are the installation instructions for Propel Admin