的目錄結構爲:如何設置未映射資源
application
models
Milestones
ObserverBroker.php => Application_Model_Milestone_ObserverBroker
Observers
Milestone.php => Application_Model_Observer_Milestone
在bootstrap.php中
$loader->addResourceType('observer','models/observers','Model_Observer');
$loader->addResourceType('observerbroker','models/milestones','Model_Milestone');
我遇到的問題是:
[[email protected]]$ php zfrun.php \
> --environment development -a task.create-milestone -m '%s' \
> -p '%s'
PHP Fatal error: Class 'Application_Model_Milestone_ObserverBroker' not found in /var/www/html/sites/plugin_handler/application/controllers/TaskController.php on line 55
Fatal error: Class 'Application_Model_Milestone_ObserverBroker' not found in /var/www/html/sites/plugin_handler/application/controllers/TaskController.php on line 55
[[email protected]]$ php zfrun.php \
> --environment development -a task.update-milestone -m '%s' -o '%s' \
> -p '%s'
PHP Fatal error: Class 'Application_Model_Milestone_ObserverBroker' not found in /var/www/html/sites/plugin_handler/application/controllers/TaskController.php on line 81
我已將目錄里程碑更改爲里程碑和觀察者觀察者。謝謝你的答案。我使用這個在trac插件上實現觀察者模式。 – Efox 2011-03-23 23:37:23