本文介绍了Sonata-admin 捆绑安装.未找到 SonataCoreBundle 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我目前正在尝试在一个空的 Symfony2.4 项目上安装 Sonata-admin 包.我下载了以下包:

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

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

我在我的 config.yml 文件中添加了这些行,如文档中所述:

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

php composer.phar update

我一直收到同样的错误:

I keep getting the same error:

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

事实上,该类似乎在我的供应商文件夹中的Sonata-project\CoreBundle"fodler 中,但这应该不是问题,因为我在 Sonata Admin Bundle 工作的旧项目上有完全相同的东西美好的.

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 ?

推荐答案

要使用 sonata 管理包,您需要在 composer.json 中包含以下包:

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",

我使用静态版本,但如果您想要最新版本,请随时将每个捆绑版本替换为dev-master".

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

以及我在 appKernel.php 中的奏鸣曲声明:

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

希望能帮到你

这篇关于Sonata-admin 捆绑安装.未找到 SonataCoreBundle 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:46