Nyded
Nyded

Reputation: 9

SonataDoctrineORMAdminExtension.php

Am trying to install sonataAdminBundle in my symfony project, here is my composer.json file

Am following https://sonata-project.org/bundles/admin/2-3/doc/getting_started/installation.html

    "sonata-project/admin-bundle": "~2.0",
    "sonata-project/doctrine-orm-admin-bundle": "2.2.x-dev"

I put this in my appkernel file

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

In my config.yml file sonata_block: default_contexts: [cms] blocks: sonata.admin.block.admin_list: contexts: [admin] Am having this issus

ClassNotFoundException in SonataDoctrineORMAdminExtension.php line 29: Attempted to load class "AbstractSonataAdminExtension" from namespace "Sonata\AdminBundle\DependencyInjection". Did you forget a "use" statement for another namespace?

Upvotes: 1

Views: 946

Answers (1)

Vasily802
Vasily802

Reputation: 1848

That's a Composer issue - the set of dependencies generated by Composer results in this bug. As of time of this post, long-term support version of Symfony is 2.8.3. Here's set of commands commands that worked for me to get this version of Symfony running with Sonata Admin:

  1. Install Symfony:

    $ symfony new my_project_name lts
    
  2. Downgrade Sensio Generator bundle to version 2.3:

    $ composer require sensio/generator-bundle "2.3.*"
    
  3. Install Sonata Admin bundle and its dependencies:

    $ composer require sonata-project/admin-bundle "2.3.*"
    $ composer require sonata-project/doctrine-orm-admin-bundle "2.3.*"
    $ composer require sonata-project/jquery-bundle
    
    • For jquery-bundle, you may see error: The child node "default_contexts" at path "sonata_block" must be configured. If you see it, go to the next step. When you done with next step, try to install jquery-bundle once again.
  4. Do rest of the steps as described in Sonata admin installation docs here: register installed bundles in app/AppKernel.php, change app/config/config.yml and app/config/routing.yml, clear cache, and install assets.

After that, you should be able to run the app.

Upvotes: 1

Related Questions