我想将我的应用程序拆分为两个包。
后端捆绑包,类似CMS admin(可重用于其他项目)和前端捆绑。
我将整个后端应用程序(包括控制器,模板和模型)移动到新捆绑包中,但是我的项目所依赖的第三方捆绑包存在问题。
例如AsseticBundle。当我向BackendBundle / config.yml添加资产配置时,我收到了一个异常。
There is no extension able to load the configuration for "assetic"
是否有一些很好的教程展示了如何将应用程序拆分为两个具有一个配置的协作捆绑包,并且两者都依赖于第三方库?
感谢您的任何建议。
答案 0 :(得分:1)
If I understand you correctly, you're trying to add 3rd party bundle configuration to your own bundle config.
This can be achieved only in app/config/config.yml
, which is loaded by default by Symfony. It's the only place where Symfony looks.
What you can do, is prepend configuration via own extension. That can be placed in your bundle:
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
class BackendBundleExtension extends Extension implements PrependExtensionInterface
{
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('assetic', array(
'key' => 'value'
));
}
}
Let me know, if this is sufficient explanation.