我已经厌倦了 Zend 的自动加载器。
我正在尝试EditPassword
从PasswordController
模块结构内部加载,如下所示。
应用程序.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"
引导程序.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 中的其他所有内容似乎都使用了相当合理的默认值——考虑到它们遵循默认的 Zend 结构并在默认的模块目录中,我真的必须为每个模块声明表单/模型/视图助手的所有路径吗?