I'm making my first zend application, but I have problems with the autoload of modules. At this time I load a form that I saved in the "forms" of the form "users", but I get a "Fatal Error". This is my configuration:
application.ini:
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resouces.modules = ""
resources.frontController.params.displayExceptions = 1
;my library dir
autoLoaderNameSpaces.test = "Test_"
resources.view.helperPath.Zend_View_Helper = APPLICATION_PATH "/modules/default/views/helpers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = layout
resources.view.doctype = "HTML5"
Dir tree:
application
-configs
-layouts
-modules
--default
--users
---controllers
----indexController.php -> class Users_IndexController extends Zend_Controller_Action
---forms
----Login.php -> class Users_Form_Login extends Zend_Form
---models
---views
---Bootstrap.php -> class Users_Bootstrap extends Zend_Application_Module_Bootstrap{}
--Bootstrap.php -> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{}
. . .
within the indexAction() of the Users_IndexController I wrote:
$form = new Users_Form_Login();
And I get this error:
Fatal error: Class 'Users_Form_Login' not found in [...]/application/modules/users/controllers/IndexController.php on line 39
EDIT
Class content in complement for @Tim Fountain:
Bootstrap files:
In Bootstrap.php:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initActionHelpers ()
{
$config = $this->getOptions();
$acl = new Test_Acl($config['acl']);
$aclHelper = new Test_Controller_Action_Helper_Acl(null, array('acl'=>$acl));
Zend_Controller_Action_HelperBroker::addHelper($aclHelper);
}
}
In /Users/Bootstrap.php:
class Users_Bootstrap extends Zend_Application_Module_Bootstrap
{
}
Each module has a bootstrap file. In the users/Bootstrap.php file have you decalred the namespace for the module?
/**
* Sets up the autoloading for this module. This function must be first in the bootstrap else other bootstrap functions might not work.
*/
protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Users_',
'basePath' => APPLICATION_PATH . "/modules/users",
));
return $autoloader;
}