Hi Alexandre,

 Usually, the best way is setting up an Intermediary model, like in
your example, Membership, and change your associations to :


  User -> hasMany  -> Membership
and
  Group -> hasMany  -> Membership
and don' t forget
  Membership -> belongsTo -> User
  Membership -> belongsTo -> Group

(you must use the table in these associations to 'memberships'. )

 by doing that, you can set value in the intermediary table, like
association order, or date of association, and role, of course :)

$this->User->Membership->findByRole( 3 )

$user =  $this->User->findById( 1 )
$user['Membership'] will have your values


 I'm not sure you must *change* the HABTM association, or if you may
just add these associations also.

 I think nate or gwoo answered this question a while ago (6, 8 months
?). search the google groups page to find more answers

 Nate, should this one go into the FAQ ?

 spark


On 3/29/07, Sonic Baker <[EMAIL PROTECTED]> wrote:
> Hi Orz,
>
> There is a way but I wouldn't call it elegant. You basically have to add an
> id field to the table and then bind it on the fly when you want to use it.
> Look to bindModel() in the API. You  would bind it as a hasMany Membership.
> You'll also have to create a Membership model.
>
> Cheers,
>
> Sonic
>
>
>
>  >
>


-- 
[web] http://synapsisdi.com.br
[livesets] http://djspark.com.br/mp3

--~--~---------~--~----~------------~-------~--~----~
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