apprentice (77) [Avatar] Offline
#1
Is it important to learn the Data Mapper pattern for ZF?
The new Quickstart tutorial is making everything I learn from the ZFiA book hard to integrate when using Data Mapper.

(I'm not going forward with ZF I want to throw it away soon and learn howto do Assembly programming instead smilie Assembly looks more doable than ZF every week that passes.)


http://martinfowler.com/eaaCatalog/dataMapper.html

http://framework.zend.com/docs/quick...database-table
akrabat (479) [Avatar] Offline
#2
Re: Is it important to learn the Data Mapper pattern for ZF?
Nope, you don't have to do data mapper at all. Table Data Gateway (http://martinfowler.com/eaaCatalog/tableDataGateway.html) is a fine pattern in its own right.

Data Mapper makes it easier to avoid "leaks" from the underlying model implementation into your controllers/view helpers. However, with discipline it's easy enough to use a TDG - just don't use fetchAll(), fetchRow(), find(), createNew() etc anywhere other than in your model class.

I find that with junior programmers around, Data Mapper makes it much easier to help them help themselves as they can't get it wrong smilie I wrote up my thoughts on it at http://akrabat.com/2008/12/13/on-models-in-a-zend-framework-application/.

Regards,

Rob...