Here's what I'm doing in the bootstrap (index.php) of a demo app I'm
working on:
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
$appDir = dirname(dirname(__FILE__)) . '/app';
set_include_path($appDir . '/models' . PATH_SEPARATOR .
get_include_path());
Following this, I have no problem loading models. Isn't this simpler
than using another helper class? Am I missing something?
However, I realize that in more complex apps, it may not be quite this
simple.
Regards,
Bill Karwin
________________________________
From: PotatoBob [mailto:potatobob@gmail.com]
Sent: Monday, June 18, 2007 11:47 AM
To: fw-general@lists.zend.com
Subject: [fw-general] Model Loading helper
Normally models are loaded through require_once() or
Zend_Loader::loadClass() with painfully long paths similar to
"module/models/Model.php" or "module/models/controller/Model.php" and
more likely "../models/controller/Model.php". After a few discussions on
#zftalk with ralphschindler,
SpotSec_Controller_Action_Helper_ModelLoader came to existence.
ModelLoader does exactly what the name says, it makes loading models one
step simpler by determining the path to the models folder so all you
have to do is specify the model's class name.
Anyways I just wanted to see some feedback, as I never actually
tested it and feel it is useless...
If you are using the conventional modular directory structure
then ModelLoader is already setup and ready to go. If you are not then
you can setup ModelLoader using __construct();
Usage: $this->_helper->ModelLoader('UserModel');
link in proposal form: ModelLoading helper
<
http://svn.ralphschindler.com/repo/ZendFramework/Zend_Controller-ModelLoader/library/Zend/Controller/Action/Helper/ModelLoader.php>
--------
SpotSec <
http://www.spotsec.com>
________________________________
View this message in context: Model Loading helper
<
http://www.nabble.com/Model-Loading-helper-tf3942096s16154.html#a11181598>
Sent from the Zend Framework mailing list archive
<
http://www.nabble.com/Zend-Framework-f15440.html> at Nabble.com.