【发布时间】:2011-08-12 22:32:50
【问题描述】:
我已经厌倦了 Zend 的自动加载器。
我正在尝试从模块结构中的PasswordController 中加载EditPassword,如下所示。
应用程序.ini
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.baseUrl = "/"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
phpSettings.date.timezone = "Europe/London"
Bootstrap.php:
public function init() {
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$baseUrl = $config->baseHttp;
define('BASE_URL', $baseUrl);
}
protected function _initAutoload() {
$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->registerNamespace('App_');
//
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH . 'modules/account',
'resourceTypes' => array(
'form' => array(
'path' => 'forms',
'namespace' => 'Form'))));
$autoLoader->pushAutoloader($moduleLoader);
//
return $autoLoader;
}
我正在像这样在控制器中加载表单:
$form = new Account_Form_EditPassword();
$this->view->form = $form;
错误本身是:
Fatal error: Class 'Account_Form_EditPassword' not found in
Z:\dat\docs\workspace\metamusic\application\modules\account\controllers\PasswordController.php
on line 7
我做错了什么? Zend 中的其他所有内容似乎都使用了相当合理的默认值 - 我真的必须为每个模块声明 all 到表单/模型/viewhelpers 的路径,因为它们遵循默认的 Zend 结构,并且在默认模块目录中?
【问题讨论】:
-
用你在控制器中加载表单的方式更新你的问题
-
已经完成了。可以肯定的是,我正在使用命令行工具创建表单模板,并且自动完成填写正确的名称。
-
看起来不错。抱歉,您得到的确切错误是什么?
-
我已经更新了这个问题,但恐怕这个错误的描述性不是很好。
-
'account' 的拼写在引导程序中拼写错误,它的 'acount' 缺少一个 'c'。
标签: forms zend-framework module zend-autoloader