Shahar Evron 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);
I completely agree with you there, and yes, it would be an optional
component of course, and what you describe works well in non-modular
environments.
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.
ModelLoader becomes important for fulfilling the role of finding the
path to models (usually based on some convention) that belong to an
in-use component.
The requirements this component fulfills is
a) ability to allow modules to take control of the loading of models and
model paths with the system
b) not require the bootstrap to be completely aware of all modules
conventions and paths to models
c) ability to register paths on on-demand and when modules are in-use
d) use Zend_Loader::loadClass() so that autoloading is not required,
thus allowing op-code caches better cacheability since LoadClass()
results in a require_once. (theoretically).
That being said, I still think there is a lot of value in such a component.
-ralph