2009年1月30日星期五

Re: [fw-mvc] Re: Separating Models from DB Access

As long as your model objects are confined to being simple data holders
with no behavior or aggregated objects or collections, you're fine. But
if you find that you want to create objects that use a lot of object
composition, it gets really hard to support with table-centric gateways
(regardless of whether or not Zend_Db_Table is involved). The Data
Mapper approach is probably the best known general way to tackle this.
That said, it's still sufficiently difficult to make table-centric
domain models viable for a lot of applications.

Regards,
Bryce Lohr


Jack Sleight wrote:
> Yeah, I'm going to allow multiple tables in some of the other models.
> Still not entirely sure how I'm going to abstract some of the
> functionality for other models, but I'm aware of the need for multiple
> tables.
>
> I've put together a prototype of this now, currently looking at moving
> all DB related logic to the Site_Gateway, so that the Site objects
> only contain arrays of raw data, not rows. Reason being some objects
> will be created from selects on joined tables, so the single row idea
> doesn't really work. Also, I might want to do a single query for a
> whole load of data (spanning multiple joined tables) and then create
> individual objects. For example, perform a query for a site and all
> it's pages, then create a single Site object which will contain
> multiple Page objects.
>

没有评论: