How about this?
Zend_Loader::loadClass('Users', dirname(dirname(__FILE__)) .
DIRECTORY_SEPARATOR . 'models');

I can almost hear the boos, but it works for a conventional modular layout.

Personally I'd like to see Zend_Controller_Action provide the info so I
could do this:
Zend_Loader::loadClass('Users', $this->getModuleDirectory() .
DIRECTORY_SEPARATOR . 'models');

No need for another helper class. No need to bloat your include_path or
bloat your boostrap.

Correct me if I'm wrong but I think Padraic advocates read only model access
from views so not sure that this would help in that, but I'm almost excited
about the big throwdown at:
http://framework.zend.com/wiki/display/ZFDEV/Zend_View+Enhancement+VS.+Zend_Layout+Throwdown

I don't get out much :)

Regards,
Mark



Shahar Evorn wrote:
> 
> I generally like the idea as long as it is kept optional. I personally
> like to load models by defining a model path (eg. APP_MODEL_DIR)
> constant in my bootstrap file, and then call
> 
> Zend_Loader::loadClass('User', APP_MODEL_DIR); 
> 
> whenever I need to. IMHO it's clean enough and super fast, and I don't
> like the idea of loading an extra class and calling some methods just
> for loading a model class. 
> 
> Shahar.
> 

-- 
View this message in context: 
http://www.nabble.com/Model-Loading-helper-tf3942096s16154.html#a11345909
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to