How to install or integrate packages in Symfony2

I downloaded the sonata administration package and placed it in /var/www/Symfony/vendor/symfony/src/Symfony/Bundle and made an entry in AppKernel.php as $bundles = array( ... new Symfony\Bundle\SonataAdminBundle\SonataAdminBundle(),) , but chose the error as

Fatal error: class 'Symfony \ Bundle \ SonataAdminBundle \ SonataAdminBundle' was not found in /var/www/Symfony/app/AppKernel.php on line 21 Call stack: 0.0001 326332 1. {main} () / var / www / Symfony / web / app_dev.php: 001 0.0122 1121592 2. Symfony \ Component \ HttpKernel \ Kernel-> handle ()

please help me since I am very new to symfony 2. In general, please give a link or detailed information on how to install / configure any downloaded package. thanks Ravi.M

+1
source share
2 answers

You need to move the node to

 /var/www/Symfony/vendor/bundles 

Then in AppKernel.php add

 new Sonata\AdminBundle\SonataAdminBundle(), 

in the $ bundles array.

In autoload.php add

 'Sonata' => __DIR__.'/../vendor/bundles', 

to the array $loader->registerNamespaces

+5
source

First of all, the SonataAdminBundle lives in the Sonata namespace, not Symfony . Therefore, you will need to rewrite the instance in app/AppKernel.php to:

 new Sonata\AdminBundle\SonataAdminBundle() 

You also need to register the namespace in app/autoload.php :

 $loader->registerNamespaces(array( ... 'Sonata' => __DIR__.'/path/to/parent/of/Sonata/folder' ... )); 
+5
source

All Articles