Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

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: 5)

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

7. Class Index

  • Zend_Controller_Action_Helper_ModelLoader

8. Use Cases

UC-01

9. Class Skeletons

]]></ac:plain-text-body></ac:macro>

]]></ac:plain-text-body></ac:macro>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 21, 2007

    <p>ralph, validModule = $this->_request->getModuleName(); should be $this->getRequest() since $this->_request needs to be populated first</p>

  2. Nov 02, 2007

    <p>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...</p>

    <p>$this->_helper->ModelLoader('Forum_Users'); </p>

    <p>Sorry if this should be obvious, but I'm just looking for clarification. </p>

    1. Nov 02, 2007

      <p>It looks to me as if you'd express that as:</p>
      <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
      $this->_helper->ModelLoader('Users', '/path/to/application/forum/models');
      ]]></ac:plain-text-body></ac:macro>
      <p>...but I haven't verified that yet <ac:emoticon ac:name="smile" /></p>

      1. Nov 02, 2007

        <p>...or...</p>
        <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
        $this->_helper->ModelLoader('Users', null, 'forum');
        ]]></ac:plain-text-body></ac:macro>

    2. Nov 03, 2007

      <p>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).</p>
      <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
       $this->_helper->ModelLoader('Forum_Users');
      ]]></ac:plain-text-body></ac:macro>
      <p> would indeed load a model named "Users" from the "Forum" module.</p>

  3. May 14, 2008

    <p>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. <ac:emoticon ac:name="smile" /> 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.</p>

    <p>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.</p>

    <p>I'm sure you thought of using Zend_Loader, so I'm curious to know why you went with an Action Helper instead?</p>