Suppose I have two bundles ParentBundle
and ChildBundle
. ChildBundle
"extends" ParentBundle
by
// ChildBundle/ChildBundle.php
<?php
namespace ChildBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChildBundle extends Bundle
{
public function getParent()
{
return 'ParentBundle';
}
}
Then, I copied the routing from ParentBundle
to ChildBundle
, and specify which routing to use in app/config/routing.yml
, as well as rename the routing.yml
as per 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: /
After that, I create a template in ChildBundle
with same path and name, to override the template in ParentBundle
of the same name.
However, it results in loading the template in ChildBundle
all the time.
So, my problem is, How do I load the ChildBundle
in one domain (i.e. use overriding templates/controllers and such in ChildBundle
, when user goes into child.example.com) while use ParentBundle
in another domain (i.e. use overriden templates/controllers and such in ParentBundle
, when user goes into example.com)?