Tuesday, 15 May 2012

php - Model and Db-Table Zend Framework -


I wanted to know that it is better to create a model that directly creates a DB-adapter or an interface with a deaf-adapter. / P>

Make classic operation crude with DB-adapter, or you can create a model that passes through all the DB-adapter:

scheme:

Controller - & gt; Model - & gt; DB-Adapter

or

Controller - & gt; DB-Adapter

  Extends application_Model_DbTable_Guestbook class Zend_Db_Table_Abstract {** A table name * / a protected $ _name = 'table'; }    

A part of your model (for example a data mapper) of DB adapter Uses To Store & amp; Retrieve the goods from the DB Controller sends the request only to the model The model calculates the goods with the DB adapter and sends it back to the controller. So that the controller could pass it in your view ...

First:

User Request - & gt; Controller - & gt; Big model - & gt; Small part of the model - & gt; DB adapter

After this (but not every DB request creates the user):

DB adapter responder - & gt; Small part of the model - & gt; Big model - & gt; Controller - & gt; View - & gt; User's screen = feedback

No comments:

Post a Comment