Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
737 views
in Technique[技术] by (71.8m points)

symfony - How to install or integrate bundles in Symfony2

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 SymfonyBundleSonataAdminBundleSonataAdminBundle(),), but throwing an error as

Fatal error: Class 'SymfonyBundleSonataAdminBundleSonataAdminBundle' 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. SymfonyComponentHttpKernelKernel->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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

new SonataAdminBundleSonataAdminBundle()

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...