Question

I'm trying to put a model into the Zend Registry from the main application bootstrap file:

public function _initRegistry()
{
    $this->bootstrap('db'); 

    $processmanager = new Systems_Model_Process();
    Zend_Registry::set('processmanager', $processmanager);
}

For some reason, I'm met with the following errors:

Warning: include_once(Systems/Model/Process.php) [function.include-once]: failed to open stream: No such file or directory in /home/planetxg/public_html/dash/library/Zend/Loader.php on line 146

Warning: include_once() [function.include]: Failed opening 'Systems/Model/Process.php' for inclusion (include_path='/home/planetxg/public_html/dash/application/../library:/home/planetxg/public_html/dash/library:.:/usr/lib/php:/usr/local/lib/php') in /home/planetxg/public_html/dash/library/Zend/Loader.php on line 146

Fatal error: Class 'Systems_Model_Process' not found in /home/planetxg/public_html/dash/application/Bootstrap.php on line 20

The model in question is in the following location:

application/modules/Systems/models/Process.php

Is there something simple I'm missing or not setting here at all? I should add everything works fine when calling models normally within controllers.

Here's my main ini block if it helps:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.actionHelperPaths.Utilities = APPLICATION_PATH "/controllers/Helpers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = 
autoloaderNamespaces[] = "CreativeLaunch_"
autoloaderNamespaces[] = "Systems_"
Was it helpful?

Solution

You need a module bootstrap class at application/modules/systems/Bootstrap.php which extends Zend_Application_Module_Bootstrap. This will setup module autoloading. Also your module folder should be lowercase - application/modules/systems.

The module resource needs to have run before your _initRegistry method in the main bootstrap file, so change the first line of that method to:

$this->bootstrap(array('db', 'modules'));

Everything else looks good.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top