简体   繁体   中英

Sonata Propel Admin - Can't Find Service

I am trying to install and use the Sonata Admin Propel Package.
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 ).

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

Registered it in 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;

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.

To do so, add this line to your AppKernel.php :

new Sonata\PropelAdminBundle\SonataPropelAdminBundle(),

Here are the installation instructions for Propel Admin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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