Question

My application structure is like this:

  • application
    • modules
      • default
      • student
        • controllers
        • forms
          • studentParent.php
        • models
        • views
        • Boostrap.php

I have a studentParent.php inside forms folder of student module.

class Student_Form_studentParent extends Zend_Dojo_Form{
}

Whenever I call this form class inside controller of student module, I get class not found error I have placed Bootstrap.php inside student module.

class Student_Bootstrap extends Zend_Application_Module_Bootstrap
{

}

Here's my application.ini file configuration

resources.frontController.params.displayExceptions = 0
resource.modules=""
resources.view = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = "main_template"

My Bootstrap.php file:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
     protected function _initDefaultModuleAutoloader()
     {
         $moduleLoader = new Zend_Application_Module_Autoloader(
    array(
        "namespace" => '',
        "basePath"  => APPLICATION_PATH.'/modules/default'
        )
      );

          Zend_Controller_Action_HelperBroker::addPrefix('App_Action_Helper');

          return $moduleLoader;
     }
}
Was it helpful?

Solution

resource.modules=""

should be:

resources.modules=""

(i.e. resources plural).

I would also recommend that you use an upper case letter to start your class names, so Student_Form_StudentParent instead of Student_Form_studentParent (the filename will need to be StudentParent.php as well). Personal preference I suppose, but if the framework does it one way and your app does it another then your class naming will not be consistent.

OTHER TIPS

Also the

$moduleLoader = new Zend_Application_Module_Autoloader(
array(
    "namespace" => '',
    "basePath"  => APPLICATION_PATH.'/modules/default'
    )
  );

The basePath should point to the dir which contains modules, not, as in Your example, to the particular module dir.

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