I am developing a multi sub-domain web application in Symfony 2.

Subdomains:

admin.example.com is the main hosting site.

is the main hosting site. member.example.com is another sub-domain pointing to same source code.

As mentioned in the documentation here, I configured routing as below :

Parent Routing for member.example.com :

my_app_member: resource: "@member.yml" prefix: / host: "member.example.com"

Note : The above routing is the parent route config for all routes for member.example.com defined in member.yml .

**Now I have anoter route for admin.example.com : **

admin_user_mod: path: /admin/new defaults: { _controller: "somecontroller" }

However if I have to generate a full url for the route admin_user_mod using code :

$modLink = $this->get("router")->generate('admin_user_mod');

The generated route path is correct but the base url still stays as member.example.com which should be admin.example.com

Is there an way, or I am missing anything in above route configuration to get the desired results.

OR

Is there any symfony event listener to overwrite router's " generate() " method call?

All your inputs are highly appreciable.

Thank you