I have a Zend Framework modular application set up. One of my modules is called ‘frontend’ and it is the default module (resources.frontController.defaultModule = "frontend" is in my config file).
I have a form, Frontend_Form_PropertySearch located at /application/modules/frontend/forms/PropertySearch.php and attempting to use it in my controller as follows:
public function searchAction()
{
$form = new Frontend_Form_PropertySearch();
$form->submit->setLabel('Search');
$this->view->form = $form;
}
However, I’m getting the following error:
Fatal error: Class ‘Frontend_Form_PropertySearch’ not found in /Users/Martin/Dropbox/Repositories/realestatecms/application/modules/frontend/controllers/PropertiesController.php on line 17
Where am I going wrong?
One of solutions could be adding file
application/modules/frontend/Bootstrap.phpand put this (similar working on one of my projects):Another solution, as described by akrabat: http://akrabat.com/zend-framework/bootstrapping-modules-in-zf-1-8/
Second one uses default resource autoloader as described in documentation: http://framework.zend.com/manual/zh/zend.loader.autoloader-resource.html#zend.loader.autoloader-resource.module