Saturday, August 1, 2009

Re: relations through habtm

that works fine! although i cant seem to constrain the number of
fields select either by contain or fields...

On Aug 1, 10:52 am, Martin Kirchgessner <martin.ki...@gmail.com>
wrote:
> Did you try to use the "recursive" param? I think you should call :
>
> $news->find('all', array("recursive" => 2));
>
> "recusive" defaults to 1, meaning it will get data from news and its
> associated models (organisations_user). That's why you don't have User
> and Organisation. By setting it to 2 find will also get fields from
> models associated to organisations_user.
>
> Hope this helps,
>
> Martin
>
> On 31 juil, 16:34, johan <forms...@gmail.com> wrote:
>
>
>
> > Ive got a small problem with my cakephp app...
>
> > I have in my design a habtm as a central table wich several other
> > table relates to.
> > This due to that Users can be members of different organisations over
> > time
>
> > news belongsTo organisations_user
> > organisations_user hasOne user, organisation
> > user hasAndBelongsToMany organisations
>
> > Problem I have is that, when using $news->find('all')  i dont get any
> > data from user och organisation
>
> > Is there any way to pull data from theese two tables via this
> > relationship?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: