Couldn't you change the condition to where the pick id is greater than 1?

I'm on my blackberry so I can't do any code samples.


On 2/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have setup where a user "picks" a "game" ...
>
> User hasMany Picks
> Picks belongsTo Game (and user)
>
> I want to return ALL 'Games' with 'MyPick' (doesn't matter if I picked
> the game or not).  It would be nice to see the hasOne relationship
> carry an "on" param that does the following ...
>
> $this->Game->bindModel(array(
>     'hasOne' => array(
>         'MyPick' => array(
>             'className' => 'PicksUsers', // NOT a habtm relationship,
> btw
>             'foreignKey' => 'game_id',
>             'on' => "MyPick.user_id='1'",
>             // 'conditions' => "PicksUsers.user_id='1'", // can't do
> this because it only will return games I picked
>         ),
>     ),
> ));
> $this->Game->findAll();
>
> Result (sql)..
> SELECT * FROM games ... LEFT JOIN picks_users As MyPick ON
> (MyPick.game_id = Game.id AND MyPick.user_id='1') ...
>
> As you can see, now all games will be returned ...
> Should I open a ticket?
>
>
> >
>


-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

rallyhat.com - digital photo scavenger hunt
@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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