On Dec 18, 9:50 pm, Ramiro Araujo <[email protected]> wrote:
> no, I'm trying stuff like this:
> $data = $this->User->find('all',
>         array(
>                 'fields' => array('User.*', 'Invitation.*'),
>                 'conditions' => array(
>                                 'Invitation.id' => NULL
>                 ),
>                 'limit' => 100,
>                 'contain' => 'Invitation'
>         )
> );
>
> but the resulting query does not JOIN with Invitation, so I get a
> error on the WHERE condition...
>
> I thought the LEFT JOIN was necessary, but the query works just fine
> with JOIN. I still don't have the complete grasp on the different
> joins, but I do understand they're not actually that different at all.
>
> Anyways, I think that managing to get the join done will make the
> query work, but I tried bindModel to add a hasOne relationship instead
> of hasMany, and didn't work also.
>
> Any more thoughts are appreciated! :)

You need a User hasOne Invitation association for the join to appear.


hth,

AD
ps WHERE i.id IS NOT NULL  is equivalent to an inner join:
http://en.wikipedia.org/wiki/Join_(SQL)#Inner_join
although it's easier simply to define the condition (exactly as rob
suggested - don't forget the not)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to