【发布时间】:2013-06-26 13:45:08
【问题描述】:
我在 Symfony2 应用程序中有以下捆绑架构:
CommonBundleFirstBundleSecondBundle
CommonBundle 中实现了一些功能。
这些功能必须在其他 2 个捆绑包中提供。
FirstBundle 和 SecondBundle 因此有它们自己的特性 + CommonBundle 的特性。这些包在主应用程序routing.yml 文件中定义了自己的主机。
我想做的事:
CommonBundle 的功能应与当前包的布局一起显示。
例如,如果我点击http://firstbundle.myapp.com/common/feature1,我应该会看到FirstBundle 包的布局。
如果我点击http://secondbundle.myapp.com/common/feature1,则应该使用SecondBundle 包的布局。
我该怎么做?
我不能使用包继承,因为同一个包不能扩展两次。
在我当前的实现中,每个包都会在自己的主机中导入CommonBundle 的路由。
【问题讨论】: