Thanks to everybody I try this thing that suggests Nate in this post
http://groups.google.com/group/cake-php/browse_thread/thread/bef70558f7854732/6363603e04fcee68?lnk=st&q=&rnum=10#6363603e04fcee68

Chris, I am so glad you asked, because this is why Cake Owns:
The solution to your problem requires a third model: PeopleSkill.
Your
model defintions should then look as follows:

class Person extends AppModel {
   var $hasMany = 'PeopleSkil';
   var $recursive = 2;

}

class Skill extends AppModel {
   var $hasMany = 'PeopleSkil';
   var $recursive = 2;
}

class PeopleSkill extends AppModel {
   var $hasOne = 'Person,Skill';
}

The real trick is in setting $recursive to 2.  Because of this, when
you query your Person model, it will pull the PeopleSkill model data,
and embedded within that data will be the associated Skill data.
This
structure will allow you to manage all the data as a cohesive unit.

thanks!

On 16 Ago, 23:13, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> and if you add 'nate' to the search you will find just what you are
> looking for ;)
>
> On 8/16/07, Samuel DeVore <[EMAIL PROTECTED]> wrote:
>
>
>
> > search the group for hasAndBelongsToMany and I bet you find a ton of help
>
> > <http://groups.google.com/group/cake-php/search?q=hasandbelongstomany+...>
>
> > On 8/16/07, Andrea <[EMAIL PROTECTED]> wrote:
>
> > > Hello to everybody! I have a problem: I want to implement a many to
> > > many relation with a cross table that has other fields. I explain
> > > better with an example:
>
> > > Users
> > > -id
> > > -name
> > > -surname
>
> > > Groups
> > > -id
> > > -name
>
> > > Users_Groups
> > > -id
> > > -user_id
> > > -group-id
> > > -join_date
> > > -kind
>
> > > As you can see the entity Users_Groups is the "bridge" in order to
> > > achieve the M2M relation.
>
> > > I now how to implement a "normal" (without additional field on the
> > > bridge table) M2M relation with the variable $hasAndBelongsToMany in
> > > the model of each entity.
>
> > > In particular I need an example with some lines of code not only for
> > > the model but also for the controller and the view :D
>
> > > For example how can I "print" the kind of relation and the date of
> > > join for one user?
>
> > > Thanks!
>
> > > Ps. sorry for the little english, but I'm italian..
>
> > --
> > (the old fart) the advice is free, the lack of crankiness will cost you
>
> > - its a fine line between a real question and an idiot
>
> >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
>
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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