Bundle "ApplicationSonataUserBundle" does not exist or it is not enabled
Asked Answered
H

7

15

I need to install the SonataUserBundle to be able to install the SonataNewsBundle.

I followed the installation Tutorial step by step but i got this error :

./app/console sonata:easy-extends:generate SonataUserBundle



  [InvalidArgumentException]                                                 
  Bundle "ApplicationSonataUserBundle" does not exist or it is not enabled.  

The bundle was not generated yet. this command should do it !

Any one has any idea how to fix this issue?

Hepplewhite answered 6/9, 2012 at 19:39 Comment(0)
D
31

Edit 2016/09/23 : this answer can be a little outdated. If this doesn't work, you can explore @ashish answer just bellow.

During the Sonata User Bundle setup, you are advised to map doctrine:orm to ApplicationSonataUserBundle, and this cannot be done during sonata:easy-extends:generate SonataUserBundle because the ApplicationSonataUserBundle doesn't exists yet.

So before lauching your sonata:easy-extends:generate SonataUserBundle command, you can comment the ApplicationSonataUserBundle line :

# app/config/config.yml
[...]
# Doctrine Configuration
doctrine:
  [...]
  orm:
    auto_generate_proxy_classes: %kernel.debug%
      entity_managers:
        default:
          mappings:
            # ApplicationSonataUserBundle: ~
            SonataUserBundle: ~

Then you launch your sonata:easy-extends:generate SonataUserBundle command, And finally, you remove comments (the #) on ***ApplicationSonataUserBundle: ~ **

Bundle “ApplicationSonataUserBundle” does not exist or it is not enabled error is gone.

Have a good day.

Doone answered 8/10, 2013 at 12:21 Comment(0)
D
22

Do following steps before running sonata:easy-extends:generate

(1) comment the ApplicationSonataUserBundle line in config.yaml

    mappings:
               # ApplicationSonataUserBundle: ~
                SonataUserBundle: ~

(2) replace Application\Sonata\UserBundle\Entity\User to Sonata\UserBundle\Entity\BaseUser

(3) replace Application\Sonata\UserBundle\Entity\Group to Sonata\UserBundle\Entity\BaseGroup

(4) run sonata:easy-extends:generate "php app/console sonata:easy-extends:generate SonataUserBundle -d src"

Now revert back step 1, 2 and 3

Drilling answered 5/7, 2014 at 16:28 Comment(1)
Thanks! This is the real solution to the issue, because after you comment # ApplicationSonataUserBundle: ~ you will get an error saying "Class 'Application\Sonata\UserBundle\Entity\User' does not exist" and composer cannot continue generating those classess. Replacing mine in the config.yml with the ones you said fixed it and i was able to generate the bundle.Decline
K
2

I got it installed by removing references to Application\Sonata\UserBundle\Entity\User and Application\Sonata\UserBundle\Entity\Group from the config.yml and 'new Application\Sonata\UserBundle\ApplicationSonataUserBundle()' from AppKernel.php.

Then run the easy extends generate command, then put the references in. I think the docs have got these steps a little mixed up. You can't make reference to a bundle in config.yml until it exists.

Krakau answered 2/4, 2013 at 10:4 Comment(0)
T
2

Hi I have face same problem.But I can solve this.Let see what I am doing :

In command :

php app/console sonata:easy-extends:generate -d src/ SonataUserBundle

And then write in AppKernel File:

new Application\Sonata\UserBundle\ApplicationSonataUserBundle

Now This is working ;)

And this command

sonata:easy-extends:generate SonataUserBundle

create Bundle in "App/" file.

Triode answered 12/12, 2013 at 7:43 Comment(0)
C
1

Your steps are right , except it has created your ApplicationSonataAdminBundle in "app/" folder , so you should cut this generated ApplicationSonataAdminBundle and paste into "src/" folder ..

Castilian answered 6/7, 2014 at 9:45 Comment(0)
C
0

Well, that command is step 5 and you need to do the first 4 steps before you can run this 5th step.

The error you get is because you have missed step 2: Installing the bundle and configuring the framework (for instance the AppKernel doesn't know about the bundle)

Cormier answered 7/9, 2012 at 22:21 Comment(0)
K
0

If you dont want to use "easy-extends" — another possible solution is to override default settings in config.yml

sonata_user:
    class:
        user: Acme\UserBundle\Entity\User
        group: Acme\UserBundle\Entity\Group
Karelian answered 12/10, 2015 at 14:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.