开发者

How to install or integrate bundles in Symfony2

开发者 https://www.devze.com 2023-04-08 20:30 出处:网络
i have downloaded a sonata admin bundle, and have placed in /var/www/Symfony/vendor/symfony/src/Symfony/Bundle, and have made an entry in AppKernel.php as$bundles = array( ...new Symfony\\Bundle\\Sona

i have downloaded a sonata admin bundle, and have placed in /var/www/Symfony/vendor/symfony/src/Symfony/Bundle, and have made an entry in AppKernel.php as $bundles = array( ... new Symfony\Bundle\SonataAdminBundle\SonataAdminBundle(),), but throwing an error as

Fatal error: Class 'Symfony\Bundle\SonataA开发者_如何学编程dminBundle\SonataAdminBundle' 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:0 0.0122 1121592 2. Symfony\Component\HttpKernel\Kernel->handle()

please help me as i am very new to symfony 2. As a whole please give a link or detail like how to install/configure any bundle that is downloaded. Thanks Ravi.M


You need to move the bundle to

/var/www/Symfony/vendor/bundles

Then in AppKernel.php add

new Sonata\AdminBundle\SonataAdminBundle(),

in your $bundles array.

In autoload.php add

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

to the $loader->registerNamespaces array


First off, SonataAdminBundle lives in Sonata namespace, not Symfony. So you'll have to rewrite the instantiation in app/AppKernel.php to:

new Sonata\AdminBundle\SonataAdminBundle()

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

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号