开发者

Zend Framework - Form class not autoloading

I'm getting

Fatal error: Class 'Form_Login' not found in /route/to/project/application/controllers/AuthController.php on line XX

when instantiating the class From_Login inside the controller. I suppose the form开发者_StackOverflow is not being autoloaded by the bootstrap class. In my bootstrap file I have this method

protected function _initAutoload(){
        $modelLoader = new Zend_Application_Module_Autoloader(array(
                        'namespace' => '',
                        'basePath' => APPLICATION_PATH));
        return $modelLoader;
    }

supposed to autoload my resources. I'm using the default project structure.

-application
 --controllers
 ---Authcontroller.php
 --forms
 ---Login.php

when I created the form with zf tool it automatically set the name as Application_Form_Login then I erased the Application_ part since I'm using "" namespace. I doesn't work either way. I've also tried setting appnamespace="" in the application.ini file but nothing happened


After trying over and over different options I got tired because it didn't work so I erased the project folder and started from the beginning whit zend tool and ... voilà, it works! In my opinion it was a problem with zend tool and/or the .zfproject.xml file since I was adding some resources manually and some others with the zf tool.


use Zend modular structure and change your class name 'Form_Login' to 'Default_Form_Login' .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜