Question

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 ?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top