【发布时间】:2014-10-08 07:29:26
【问题描述】:
我有两个包 A 和 B,在 B 中我需要覆盖 A 的模板,所以我使用了bundle inheritence。 到目前为止一切正常,但现在我只需要在某些特定情况下覆盖包 A 的模板。我在包 B 的操作中尝试了这个(它覆盖了包 A 的操作):
class ArticleController extends BaseArticleController
{
public function detailsAction(Request $request, $article)
{
if('general' === $article->getType()) {
// this doesn't return the template of the bundle A :(
return parent::detailsAction($request, $article);
}
// else go on on rendering the other template...
}
但这无论如何都会覆盖,即使我的文章的类型是'general',它也会返回包 B 的模板
【问题讨论】:
标签: symfony overriding bundle