有没有一种方法可以为每个模块建立模型?我有3个模块,其中一个是“contacts”模块。 我创建了它模块/联系人/模型/模型Codes.php 代码控制器Zend Framework模块化应用程序,无法为每个模块加载模型,自动加载模型?
class Contacts_CodesController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function indexAction()
{
$codesTable = new Contacts_Model_Codes();
}
代码型号:
class Contacts_Model_Codes extends Zend_Db_Table
{
protected $_name = 'codes';
}
的错误,我得到: 致命错误:类'Contacts_Model_Codes'找不到/Applications/MAMP/htdocs/zf_site/application/modules/contacts/controllers/CodesController.php 26行
感谢
这仅仅是ZF 1.8属实,在这个版本中添加的模块自动加载和Zend_Application用它来引导模块。 在旧版本中,您将需要使用Zend_Application_Resource_Modules – NDM 2009-10-06 10:58:29