Bill Karwin wrote:
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.
Yep :)
If you are developing a modular and portable application, models will
exist in the module directory. Like:
/application
/user
/modules
/blog
/controllers
/models
/views
/default
.... (so and so forth) ...
/users
.... (so and so forth) ...
/forum
.... (so and so forth) ...
So, given that senario, its hard to know at bootstrap time, all of the
different paths to all the different modules. This helper allows you to
create more portable code. Also, what if you don't want to use the
autoloader for purposes of APC or Bytecode? This way, you are making
(effectively) the include_once call that comes along with loadClass.
This also allows you to jumpstart your applicaiton with pre-fabricated
functionality, and also allows you to "import" models from other modules
at development time.
-ralph