I've setup my application with Zend_Application. I have an _initAutoload()
method in my Bootstrap.php wich looks like this:
public function _initAutoload(){
$this->bootstrap("frontController");
$front = $this->frontController;
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Client_');
$autoloader->registerNamespace('Frontend_');
$autoloader->registerNamespace('Global_');
$autoloader->registerNamespace('Global_Helper_');
$autoloader->setFallbackAutoloader(true);
$modules = $front->getControllerDirectory();
$default = $front->getDefaultModule();
foreach (array_keys($modules) as $module) {
if ($module === $default) {
continue;
}
$autoloader->pushAutoloader(new Zend_Application_Module_Autoloader(array(
"namespace" => ucwords($module),
"basePath" => $front->getModuleDirectory($module),
)));
}
return $autoloader;
}
I have setup FrontController to prefix the default module also (seems more logical to me) $front->setParam("prefixDefaultModule", true)
I think I have the usual directory structure.
The problem:
I've set up subdomains for every module that I have. Everything works fine in the main main domain (www). The main module is frontend. If frontend is the default module then stuff works :). Ok. Now. For every subdomain, I have the same index.php but theres changed the env value. For client subdomain the env value is client etc. Each env value corresponds to my application.xml section. Each application.xml subdomain section (client, api, etc) extend the main section which is called defaults (currently theres a testing section also which enables errors etc, so every subdomain extends testing and testing extends defaults).
Each subdomain section of the application.xml changes the default module name. So for section defaults its frontend, for section client its client, etc.
Now
When I access domain.com/client or domain.com/api - its fine. Both API & Client use Client_Model_NameOfTheModel and like it supposed to - it's located application/modules/client/models/NameOfTheModel.php and the DbTable/NameOfTheModel.php
WORKS
BUT When I access the the module from its respective subdomain (client.domain.com, api.domain.com, etc) and the default module has been changed from frontend to its respective subdomain module name - it ends working. It even doesn't output that "stack trace".
Warning: include(Client/Model/ContactLists.php) [function.include]: failed to open stream: No such file or directory in [heres-my-path-to-root]/library/Zend/Loader.php on line 136
Warning: include() [function.include]: Failed opening 'Client/Model/ContactLists.php' for inclusion (include_path='[heres-my-path-to-root]/library:.:/usr/lib/php:/usr/local/lib/php') in [heres-my-path-to-root]/library/Zend/Loader.php on line 136
Fatal error: Class 'Client_Model_ContactLists' not found in [heres-my-path-to-root]/application/modules/client/controllers/ContactListsController.php on line 4
I've tried 2 days to get it working. It just doesn't. It just works under the default domain and doesn't when the application.xml changes its default module to its subdomain name. Like that. This point is very very crucial currently because I can't continue and this app needs to be out of sandbox (in early beta) by the end of this week.
Thanks for anyone for some advice.
PS. Sorry for the poor English. It isn't my native tongue