Zend Framework: Zend_Controller_Action_Helper_ModelLoader Component Proposal
| Proposed Component Name | Zend_Controller_Action_Helper_ModelLoader |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Controller_Action_Helper_ModelLoader |
| Proposers | Ralph Schindler Geoffrey Tran |
| Revision | 1.0 July 31 2007 (wiki revision: 4) |
Table of Contents
1. Overview
Zend_Controller_Action_Helper_ModelLoader aims to allow module based systems load model files from within its own module as well as outside modules. This will promote best practices within the Zend Framework.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
4. Dependencies on Other Framework Components
- Zend_Loader
- Zend_Controller_Front
- Zend_Controller_Action
- Zend_Controller_Action_Helper
- Zend_Exception
5. Theory of Operation
6. Milestones / Tasks
- Milestone 1: design notes will be published here
7. Class Index
- Zend_Controller_Action_Helper_ModelLoader
8. Use Cases
| UC-01 |
|---|
9. Class Skeletons
What about the ability to load models that may exist in other modules? For example, what if I'm trying to load a model named "Users" which is located in the "Forum" module? Would I be able to do something like...
$this->_helper->ModelLoader('Forum_Users');
Sorry if this should be obvious, but I'm just looking for clarification.
I have a question I've been wondering about. Why make it an Action Helper? Surely you want to be able to utilize the loader within your model layer as well? I know I do.
If you adhere to the principles of MVC even the view layer should be able to read from the model layer, and would need access to the loader.
Why not just do something similar to Zend_Loader/PluginLoader? That way you can access it from wherever you want to. Could add an autoloader as well that could be registred in the boostrap or similar for autoloading of models.
I'm sure you thought of using Zend_Loader, so I'm curious to know why you went with an Action Helper instead?
ZF Home Page
Code Browser
Wiki Dashboard
ralph, validModule = $this->_request->getModuleName(); should be $this->getRequest() since $this->_request needs to be populated first