Hm ok I get your point. I'll try to get it working with the select object.
One final thing that came to mind was this:

    protected $_referenceMap = array(
        'Like' => array(
            'columns'           => 'food_id',
            'refTableClass'     => 'Food',
            'refColumns'        => 'id',
            'where'              => 'status = likes'
        ),
        'Hate' => array(
            'columns'           => 'food_id',
            'refTableClass'     => 'Food',
            'refColumns'        => 'id',
            'where'              => 'status = hates'
        ),
    );

But that propably interferes with the table data gateway as well..

Thank you for your time anyway!

Kind regards,
Joris Aerts



Bill Karwin wrote:
> 
> We have had a few similar feature requests for Zend_Db_Table
> http://framework.zend.com/issues/browse/ZF-553
> http://framework.zend.com/issues/browse/ZF-1182 
> 
> In general, I have declined those feature requests.  Zend_Db_Table
> implements a specific pattern called Table Data Gateway, which does not
> include support for all the SQL query clauses like WHERE, GROUP BY,
> ORDER, etc.
> 
> If you need the flexibility of SQL, then you should probably use a SQL
> query.
> 
> Regards,
> Bill Karwin
> 
>> -----Original Message-----
>> From: Jorisa [mailto:[EMAIL PROTECTED] 
>> Sent: Tuesday, June 12, 2007 7:47 AM
>> To: [email protected]
>> Subject: [fw-general] RE: Many-to-many Relationship question
>> 
>> 
>> 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-tf3894110s16
>> > 15
>> > 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-tf389
>> 4110s16154.html#a11080212
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Many-to-many-Relationship-question-tf3894110s16154.html#a11098835
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to