Symfony2: How to dynamically register a bundle (and clear the cache) from other bundle's controller

◇◆丶佛笑我妖孽 提交于 2020-01-01 18:52:26

问题


I'm creating some kind of an 'ready to be extended' admin panel. What I'm trying to do is a module for extending some admin panel features by downloading a proper bundle and install it from within admin panel.

I have prepared an additional gallery module and I don't wan to enable it with the standard version of admin panel (or even deploy this bundle to the prod server). The extra gallery bundle should only be installed from, let's say an admin panel/modules site. Where user could upload the gallery module(a bundle, downloaded from the server) and let the application handle the rest which would be: extract the bundle to src/proper_path, register it in AppKernel.php and clear the cache(if it's necessary). The final and only question is: is it possible in Symfony2 and how it can be done?

Is it possible to dynamically register bundles in Symfony2? says it is, but is it a proper or only way? And what about cache clearing, can I run it form a controller? Does the Composer have anything to do with the whole problem, or can help? Extending features of the site using that method is very pupular in many of public free CMS. Do you have any experience or words of wisdom?

来源:https://stackoverflow.com/questions/10572966/symfony2-how-to-dynamically-register-a-bundle-and-clear-the-cache-from-other

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!