I have a big ZF2 project using a lot of modules.
We need to find a way to automatically PREPEND an Optional custom route to every existing route in all modules, using code from only One module.
And it needs to work with the Url view helper.
In every module I have the default route which is basically : /ModuleName[/:controller[/:action]]
But my new module (Company) needs to add a Company context to every route like so : [/company/:company_id] /ModuleName[/:controller[/:action]]
As you may have understood, the /company/id part is Optional, and I need a default company_id.
I do not want to add this route in every module's config file.
I tried adding a route in the Company module's config file, but I quickly understood that we cannot define the MODULE parameter inside the route definition, since Zend2 uses namespaces instead.
Also, we will need to do the same thing for langs.
At the end, we will need something like this :
[/:lang][/company/:company_id]/ModuleName[/:controller[/:action]]
Without changing the current config files in any other existing module.
Anyone has The solution for this ?
thank you !