Assumed that you do a findAll from the controller to variable named holiday.
You can access it from $holiday['Holiday']['Product'] array.

If you're not sure, you can try inserting
  debug($holiday);
to see the structure of your variable.

-----Original Message-----
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of leamas
Sent: 18 Desember 2006 3:38
To: Cake PHP
Subject: Re: Joining 2 tables - better practice?


class Holiday extends AppModel
{
     var $name = 'Holiday';
     var $hasMany = 'Product';
}

class Product extends AppModel
{
   var $name = 'Product';
   var $belongsTo = 'Holiday';
}


This is what I've done and now my next question will be:  If I have
this, then in my view (/views/holidays/christmas.thtml), how do I
retrieve the products that only pertain to Christmas when I can only
access the holidays table?

Brandon Olivares wrote:
> Why not a hasMany association for holidays to products, and a belongsTo
> association for the other way? I don't see why this wouldn't work?
>
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf
> Of leamas
> Sent: Sunday, December 17, 2006 2:27 PM
> To: Cake PHP
> Subject: Joining 2 tables - better practice?




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