Products

PHPMag.ru: Zend Framework: models auto-loading

From the PHPMag.ru site comes a recent post looking at a technique for creating auto-loading models in your Zend Framework application.

When it comes to MVC, ZF handles almost everything - your action controllers are triggered, your views are loaded, w/o you having to worry about them. Not the same with models. If you comply to directory layout advised by ZF, you have "models" folder, but framework doesn't interact with it in any way.

There's a three step process he includes to make your models autoload - extend the Zend_Controller_action for the controller you're working with, put loadModel() method into the controller (what will actually load the models) and an optional third step of adding in class autoloading. A few alternatives are also mentioned: Zend_Load_PluginLoader, Zend_Load subclassing and a controller plugin.

Related posts:

  1. Zend Developer Zone: Zend Framework v1.7.4 Released The latest version of the Zend Framework, v1.7.4, has been released for download. Some of the updates and fixes included in this release are: Correction of the caching example...
  2. Zend Developer Zone: Zend Framework v1.7.3 Released The Zend Developer Zone has posted an update about the release of the latest stable version of the Zend Framework - version 1.7.3: The last DevZone post about Zend...
  3. PHPImpact Blog: Zend Framework: The Cost of Flexibility is Complexity Sometimes power comes at a price - you get benefits from the added features and functionality, but you can lose something else along the way - the simplicity that...

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>