[ZF Developers] Table Data Gateways and Data Mappers

8 views
Skip to first unread message

DNoe

unread,
May 10, 2010, 6:14:52 PM5/10/10
to Zend Framework Developers
If you have gone through the ZF Quickstart in the manual, then you
have come across the section on creating a model in the Guestbook test
app. (http://framework.zend.com/manual/en/learning.quickstart.create-
model.html) Here, they discuss using "Table Data Gateways" and "Data
Mappers" to separate class functionality dealing with database
interaction from the rest of the class. In practice, however, it
seems that many people do not use these layers.

Do you? Why or why not? I am interested in hearing what others are
doing.

DNoe

--
You received this message because you are subscribed to the Google Groups "Zend Framework Developers" group.
To post to this group, send email to zfdeve...@googlegroups.com.
To unsubscribe from this group, send email to zfdevelopers...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zfdevelopers?hl=en.

Ben Peeters

unread,
Dec 15, 2010, 4:32:20 AM12/15/10
to zfdeve...@googlegroups.com
Hi DNoe,

I'm using Table Data Gateways classes and Row Data Gateway classes separate from the model classes. My models also have a has-a relationship (composition) with its data sources which abstracts the data source from the model. This way the model doesn't depend on its data sources and will work always the same whatever the data source is. For example: if we have today a MySQL table storing the customer data and later we want to change this and use a webservice as the data source, then this is easy to implement by using this loosly-coupled model - data source architecture. By having this architecture, it's also possible to unit test the model without the need for a database.

Ben
Reply all
Reply to author
Forward
0 new messages