Andrea, there is also the 'with' parameter in 1.2: worth searching for also, essentially does similar stuff. Not sure which is more 1.2 "way" of doing things.
Luke On Aug 17, 8:29 am, Andrea <[EMAIL PROTECTED]> wrote: > Thanks to everybody! I've try it and I'm able to implements what I > wants... > > Thanks! > > Bye Andrea > > On 17 Ago, 09:07, Andrea <[EMAIL PROTECTED]> wrote: > > > Thanks to everybody I try this thing that suggests Nate in this > > posthttp://groups.google.com/group/cake-php/browse_thread/thread/bef70558... > > > 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 [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 -~----------~----~----~----~------~----~------~--~---
