Ok, then what If I would like to fetch all Xrefs, with status='likes'. As far
as I know this isn't possible with the current api and I think this would be
a pretty common action.
for example
$where = $db->quoteInto("status = ?", "loves");
$friend->findDependentRowset('FoodXref', null, $where);
Is this something I could post on the issue tracker as suggesion or is this
generally a bad idea?
Kind regards,
Joris Aerts
Bill Karwin wrote:
>
> Yes, in the current implementation of findManyToManyRowset(), none of
> the columns from the FoodXref table are returned.
>
> This is because a Zend_Db_Table_Rowset always contains columns from only
> one table.
>
> So you'll have to do the query another way, as you describe.
>
> Regards,
> Bill Karwin
>
>
> ________________________________
>
> From: Jorisa [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 09, 2007 4:39 AM
> To: [email protected]
> Subject: [fw-general] Many-to-many Relationship question
>
>
>
> Hi, Suppose I've got 3 tables:
>
>
> Friends
> - id
> - name
>
> Food
> - id
> - name
>
> FoodXref
> - id
> - friend_id
> - food_id
> - status
>
>
>
> Now I want to fetch what food some friend likes or not, so I do
>
>
> $friend = $friendsFactory->fetchById(3);
> $foodlist = $friend->findManyToManyRowset('Food', 'FoodXref');
>
>
>
> This way I get all the food linked to friend 3 by FoodXref. But
> what if I want the status field from the xref table as well? (So I can
> get Peter loves Pizza, Peter hates Salad)
>
> Is there a simple solution to accomplish this? Or do I need to
> fetch the Xref table, and then get the friend's name for every row
> myself?
>
> Thanks.
>
> Kind regards,
> Joris Aerts
>
>
> ________________________________
>
> View this message in context: Many-to-many Relationship question
> <http://www.nabble.com/Many-to-many-Relationship-question-tf3894110s1615
> 4.html#a11039613>
> Sent from the Zend Framework mailing list archive
> <http://www.nabble.com/Zend-Framework-f15440.html> at Nabble.com.
>
>
>
>
--
View this message in context:
http://www.nabble.com/Many-to-many-Relationship-question-tf3894110s16154.html#a11080212
Sent from the Zend Framework mailing list archive at Nabble.com.