Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle "ApplicationSonataUserBundle" does not exist or it is not enabled

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?

like image 424
skonsoft Avatar asked Sep 06 '12 19:09

skonsoft


2 Answers

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

like image 33
Ashish Avatar answered Sep 28 '22 07:09

Ashish


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.

like image 83
David Jacquel Avatar answered Sep 28 '22 05:09

David Jacquel