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
Labels:
None
6 Comments
comments.show.hideAug 21, 2007
Geoffrey Tran
ralph, validModule = $this->_request->getModuleName(); should be $this->getRequest() since $this->_request needs to be populated first
Nov 02, 2007
Sean St. Heart
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.
Nov 02, 2007
Simon Mundy
It looks to me as if you'd express that as:
...but I haven't verified that yet
Nov 02, 2007
Simon Mundy
...or...
Nov 03, 2007
Aaron Heimlich
I'm using this in my current project and you hit the nail right on the head (at least with the copy I'm using).
would indeed load a model named "Users" from the "Forum" module.
May 14, 2008
Jens Ljungblad
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?