I need to have different routes pointing to the same bundle. Ex: /mkt/contacts and /crm/contacts should pointing to the same contact bundle.
Why? I am developing a platform (one symfony2 project), that have many applications (A marketing application, a CRM application and more. Each application is a group of modules (bundles), some of them are shared between applications (Like ContactsBundle).
What I need to do is that the route prefix of the shared bundles are relative to the current application, so if the user is in the Marketing Application (/mkt/) then the route prefix to the ContactBundle should be /mkt/contact. But if it is in the CRM application it should be /crm/contacts
I think I can create two route resources in routing.yml like so:
route1:
resource: "@Contactundle/Resources/config/routing.yml"
prefix: /crm/contact
route2:
resource: "@ContactBundle/Resources/config/routing.yml"
prefix: /mkt/contact
The biggest problem is in the views when using path function. How do I know the name of the route? The only possible solution I can think of is to create some twig extension which checks the current pathinfo and return the correct route prefix.
Any better ideas?