On Jul 17, 2010, at 9:19 AM, Brad Waite wrote:
Table Row Gateway is intended only to give an object interface to therow of data.
I'll accept that. But when would you extend it? Allen in ZFiA (p117-118) advocates adding "parts" to the Row Data Gateway that manipulate the row's data and using __get() to handle method requests.
I'd extend the Row class only to add operations on a row of data. For example:
- Transforming values as you save them or retrieve them. For example, if you use the Serialized LOB pattern (this is in PoEAA too), you could serialize a PHP object before saving in the database, and unserialize it as you fetch it.
- Enabling the row as the subject of an Observer.
- Other uses of Proxy or Decorator, such as logging or access control.
I've written a class that fetches hierarchical data from a db table, and I extended the Row class so that each Row has a reference to a Rowset which is its children. I've committed my experimental code to the ZendX incubator:
Regards,
Bill Karwin
没有评论:
发表评论