开发者

Table Data Gateway, Cascading one-to-many, and Zend

I am new to Zend Framework and OO design patterns.

I have three tables: O开发者_运维知识库wners, Shops and Products. One Owner has many Shops; and each Shop has many Products.

I have extended Zend's DB Table Abstract for each of the three tables, and setup dependent tables and reference maps.

If I want to find which Products are available from a particular Owner, I start with an Owner object and use findDependentRowset to get a rowset of Shops. I then iterate the rowset to find all Products (again using findeDependentRowset).

Is there a shortcut for doing this? How do you go about navigating three such tables using the Table Data and Row Data Gateway patterns? (Or should I be moving to a Data Mapper perhaps?)

Thanks for your thoughts!


I think what you can use is findManyToManyRowset method.

For example to find produces for a given owner you could be able do:

$productsRowset = $ownerRow->findManyToManyRowset('Products_Table_Model','Shops_Table_Model');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜