Sonata-admin Bundle installation. Class SonataCoreBundle not found

纵饮孤独 提交于 2019-12-11 08:23:39

问题


I'm currently trying to install the sonata-admin bundle on an empty Symfony2.4 project. I downloaded the following bundles:

php composer.phar require sonata-project/admin-bundle
php composer.phar require sonata-project/doctrine-orm-admin-bundle

I register these bundles in my appkernel.php:

new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\jQueryBundle\SonatajQueryBundle(),
new Knplabs\KnpMenuBundle\Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),

I added these lines in my config.yml file as stated in the documentation:

sonata_block:
    default_contexts: [cms]
    blocks:
        # Enable the SonataAdminBundle block
        sonata.admin.block.admin_list:
            contexts:   [admin]

But each time I try to run :

php app/console assets:install web

or

php composer.phar update

I keep getting the same error:

class 'Sonata\CoreBundle\SonataCoreBundle" not found in AppKernel.php

In fact the class seems to be in a "Sonata-project\CoreBundle" fodler in my vendor folder, but it should'nt be a problem as I have the exact same thing on an older project where the Sonata Admin Bundle works fine.

Does anybody know what I'm doing wrong here ?


回答1:


to use sonata admin bundle , you need the following bundle in your composer.json :

    "knplabs/knp-snappy-bundle": "dev-master",
    "knplabs/knp-menu-bundle": "~1.1",
    "sonata-project/core-bundle": "2.2.4",
    "sonata-project/media-bundle": "2.2.7",
    "sonata-project/admin-bundle": "2.2.9",
    "sonata-project/notification-bundle": "2.2.4",
    "sonata-project/jquery-bundle": "1.8.x-dev",
    "sonata-project/cache-bundle": "2.1.5",
    "sonata-project/easy-extends-bundle": "2.1.4",
    "sonata-project/exporter": "1.3.1",
    "sonata-project/doctrine-extensions": "1.0.1",
    "knplabs/gaufrette": "dev-master",
    "sonata-project/block-bundle": "2.2.9",
    "sonata-project/doctrine-orm-admin-bundle": "2.2.6",

i use static version but if you want the lastest, feel free to replace each bundle version by "dev-master".

and my declaration in appKernel.php for sonata :

        new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),

        new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
        new Sonata\CoreBundle\SonataCoreBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Sonata\CacheBundle\SonataCacheBundle(),
        new Sonata\jQueryBundle\SonatajQueryBundle(),
        new Sonata\AdminBundle\SonataAdminBundle(),

hope it will helps



来源:https://stackoverflow.com/questions/22227123/sonata-admin-bundle-installation-class-sonatacorebundle-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!