phpzend-frameworkbootstrappingzend-framework-moduleszend-application

Module Bootstrap not working


I have a Person Module and here is my bootstrap:

application/modules/person/Bootstrap.php

class Person_Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
    protected function _initAutoload() {
        $personLoader = new Zend_Loader_Autoloader_Resource( array (
            'basePath'  =>  APPLICATION_PATH . '/modules/person',
            'namespace' =>  'Person',
            'resourceTypes' =>  array (
                                        'form'  =>  array ( 'path'  =>  'forms/', 'namespace' =>  'Form_' ),
                                        'model' =>  array ( 'path'  =>  'models/', 'namespace' =>  'Model_' )
                                      );
        ));
        return $personLoader ;
    }
} // end class

But whenever I go to any controller/action of this module, it is not considering this bootstrap. Therefore I am unable to access forms in this module like:

class Person_Form_MyForm extends Zend_Form {

   // elements
}

Solution

  • Zend_Application_Bootstrap_Bootstrap is for your application Bootstrap, which goes into application/Bootstrap.php

    When creating a module bootstrap, you should extend Zend_Application_Module_Bootstrap class.