Does anyone know of a way to set the default module dynamically in Zend Framework and not run into namespace issues? For example, what I want to do is have a table of modules that are allowed to be loaded, with one of them set as the default module. For example, I may have:
admin
blog
calendar
as modules that can be loaded. If I have 'blog' as the default module, then 'admin' and 'calendar' have to have their controllers namespaced (Admin_IndexController, Calendar_IndexController) while 'blog' isn't (IndexController).
If I change 'calendar' to be the default module, ZF can no longer find the classes because of the namespacing.
How do you get around that? I'm currently using the following code:
$modules = new Modules();
$activeModules = $modules->fetchActive();
foreach($activeModules as $mod) {
$loadedModules[$mod->name] = '..application/modules/' . $mod->name . '/controllers';
if($mod->default) {
$defaultModule = $mod->name;
}
}
$frontController->setControllerDirectory($loadedModules);
$frontController->setDefaultModule($defaultModule);