Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
752 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 Reply

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'
...
));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...