2009年3月31日星期二

[fw-db] Table relationships on Rowset object

Hi,

Is there anyway to use the relationship automagic to work with Rowset
objects?

I'm looking at the docs and it doesn't seem so, but I just wanted to check.
For example, let's say I have a 'post' table and I query for 5 rows. For
each 'post' Row that exists in the returned Rowset, I also want to get the
associated 'tag' rows (Toxi like schema: post - tag - post_tag). Is there
anyway to use the findDependentRowset() method to operate on the 'post'
Rowset that is initially returned? I'm thinking possibly by taking the
primary keys of each Row object in the Rowset and forming an IN condition in
the second query. So something like the following would be created:

SELECT `tag`.*, `post_tag`.* FROM `tag` INNER JOIN `post_tag` ON `tag`.`id`
= `post_tag`.`tag_id` WHERE `post_tag.post_id IN (1,2,3,4,5);

Thanks.
--
View this message in context: http://www.nabble.com/Table-relationships-on-Rowset-object-tp22817263p22817263.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: