简体   繁体   English

Sonata-admin捆绑安装。 找不到SonataCoreBundle类

[英]Sonata-admin Bundle installation. Class SonataCoreBundle not found

I'm currently trying to install the sonata-admin bundle on an empty Symfony2.4 project. 我目前正在尝试在一个空的Symfony2.4项目上安装sonata-admin捆绑软件。 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: 我在我的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: 如文档中所述,我在config.yml文件中添加了以下行:

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. 实际上,该类似乎在我的供应商文件夹中的“ Sonata-project \\ CoreBundle”文件中,但是这应该不是问题,因为我在Sonata Admin Bundle可以正常工作的旧项目中完全一样。

Does anybody know what I'm doing wrong here ? 有人知道我在做什么错吗?

to use sonata admin bundle , you need the following bundle in your composer.json : 要使用sonata管理员捆绑包,您需要在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". 我使用静态版本,但如果要最新的版本,请随时用“ dev-master”替换每个捆绑版本。

and my declaration in appKernel.php for sonata : 和我在appKernel.php中的奏鸣曲声明:

        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 希望这会有所帮助

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

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