-- keith Pope <[EMAIL PROTECTED]> wrote
(on Tuesday, 11 November 2008, 01:39 PM +0000):
> I am just wondering what the recommended way to load models is.
> 
> 1) Add model directories to the path and use Zend_Loader
> 2) Use the Plugin Loader
> 
> I ask as there has been discussion on speed and the differences
> between ZL and PL, I was wondering what the most efficient out of the
> two.

You're going to have potential inefficiencies with both.

If you go for (1), then if your app grows, you'll start adding paths for
each module, and the larger your include_path grows, the more liklihood
of naming conflicts and the more inefficient the lookups will become.

If you go for (2), you'll have a performance decrease right off the bat
-- but you can alleviate most of that with the new PluginLoader include
file cache that ships with 1.7.0. You can also then prefix your classes
per-module.

I personally usually go with (2), and you can see an example of how I
approach it in the bugapp demo I wrote for the DPC earlier this year:

    http://github.com/weierophinney/bugapp

In that, I use an action helper that uses an internal PluginLoader to
grab models. (Helpers are in application/controllers/helpers/)

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to