【发布时间】:2012-12-28 05:43:06
【问题描述】:
假设我有两个捆绑包ParentBundle 和ChildBundle。 ChildBundle“扩展”ParentBundle by
// ChildBundle/ChildBundle.php
<?php
namespace ChildBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChildBundle extends Bundle
{
public function getParent()
{
return 'ParentBundle';
}
}
然后,我将路由从ParentBundle复制到ChildBundle,并在app/config/routing.yml中指定要使用的路由,并将routing.yml重命名为Symfony2 bundle inheritance losing parent bundles routes
// app/config/routing.yml
child:
resource: "@ChildBundle/Resources/config/routing_child.yml"
hostname_pattern: child.example.com
prefix: /
parent:
resource: "@ParentBundle/Resources/config/routing.yml"
prefix: /
之后,我在ChildBundle 中创建一个具有相同路径和名称的模板,以覆盖ParentBundle 中的同名模板。
但是,它会导致一直在ChildBundle 中加载模板。
所以,我的问题是,在使用 @ 987654337@ 在另一个域中(即,当用户进入 example.com 时,在 ParentBundle 中使用覆盖的模板/控制器等)?
【问题讨论】:
标签: symfony symfony-2.2