deerly Posted July 4, 2009 Share Posted July 4, 2009 Hello! I am new to ZF and MVC in general and am working on my very first ZF application which at the moment is entirely a learning effort. My question is regarding experimenting with this tutorial: Login and Authentication with Zend Framework - phly, boy, phly I put the LoginForm class in a file called Login.php in /applications/forms However, when i call getForm() I receive the following error: Fatal error: Class 'LoginForm' not found in /home/gurriburd/dev/application/controllers/LoginController.php on line 7 Seems that it cannot locate the form. I'm wondering if there is a basic naming convention or expectation that I am overlooking. ??? Thanks so much! Quote Link to comment https://forums.phpfreaks.com/topic/164731-zf-class-not-found/ Share on other sites More sharing options...
trq Posted July 4, 2009 Share Posted July 4, 2009 Is /applications/forms within your include path? Quote Link to comment https://forums.phpfreaks.com/topic/164731-zf-class-not-found/#findComment-868693 Share on other sites More sharing options...
Cagecrawler Posted July 6, 2009 Share Posted July 6, 2009 Try naming the class Default_Form_Login, keeping filename and place the same. If this doesn't work, you'll have to set up a specific autoloader. If you're using Zend_Application_Module_Autoloader (as they do in the quickstart guide) then the example they provide should work (I haven't tested). Insert the following function into your bootstrap. <?php protected function _initAutoload(){ $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Default_', 'basePath' => dirname(__FILE__), )); return $autoloader; } I'm actually using Zend_Loader_Autoloader (for more complex things) - below is how I solve it. <?php protected function _initAutoload(){ $resourceLoader = new Zend_Loader_Autoloader_Resource(array( 'basePath' => APPLICATION_PATH, //APPLICATION_PATH is is folder Bootstrap.php is in 'namespace' => 'Default', )); $resourceLoader->addResourceType('form','forms/','Form'); } Quote Link to comment https://forums.phpfreaks.com/topic/164731-zf-class-not-found/#findComment-869480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.