Not sure if this is close to what you need,
http://www.bbartel.ca/blog/brenton/2008/oct/14/habtm-searching
(will touch up formatting shortly).
On Oct 14, 3:16 am, hariharan <[EMAIL PROTECTED]> wrote:
> I am also stuck with the same problem . For HABTM or hasMany it doesnt
> query with join. rather queries each and every table in an individual
> manner, which is time consuming one.
>
> Another thing is cakephp does not support through association like
> ROR. suppose if I have two HABTM then i cant access the fields of the
> extra table formed due to the relationships.
>
> eg user and group
>
> users -> HASMANYANDBELONGSTO -> groups
> groups -> HASMANYANDBELONGSTO -> users
>
> so the other table result due to this is groups_users. other than
> group_id and user_id suppose if i want to store additional info such
> as when did they joined group etc... i cant access those fields.....
>
> help me.....
>
> On Oct 8, 1:56 am, jmmg77 <[EMAIL PROTECTED]> wrote:
>
> > Okay,
>
> > Whenever I have a hasOne or belongsTo association, those models are
> > included in the query whenever I do a find('all');
>
> > But, when I have any other type of association, find('all' only
> > generates a query with the model I'm searching.
> > This keeps me from filtering by fields in the related models.
>
> > ex:
> > $funnypeople = $this->Individual->find('all', array('conditions' =>
> > array('Personality.type' => 3)));
>
> > This example works find if a person only has one Personality Type.
> > But what about this.
>
> > $racecardrivers = $this->Individual->find('all', array('conditions' =>
> > array('Vehicle.type' => 2)));
>
> > The problem here is a person could own multiple vehicles, so belongsTo
> > & hasOne don't work here.
> > I would need hasMany or hasAndBelongsToMany, which makes those model
> > inaccessible using find.
>
> > Any help would be greatly appreciated. Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---