Can I do 'with' associations without HABTM?

2007-05-23 Thread bilh

Hi folks,

I'm adapting an app to CakePHP, learning as I go. Here's my question:

I have three models:

Store hasMany Forms
Form belongsTo Store, hasMany Orders
Order belongs to Form

What would be the CakePHP way to get all Orders for a given Store?

I think what I am trying to accomplish is something like Store hasMany
Orders through Forms.

I'm new to CakePHP, so please excuse my ignorance! Any more info I can
provide, let me know

Thanks so much!

Bil


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



Re: Can I do 'with' associations without HABTM?

2007-05-23 Thread John David Anderson (_psychic_)


On May 23, 2007, at 11:02 AM, bilh wrote:


 Hi folks,

 I'm adapting an app to CakePHP, learning as I go. Here's my question:

 I have three models:

 Store hasMany Forms
 Form belongsTo Store, hasMany Orders
 Order belongs to Form

 What would be the CakePHP way to get all Orders for a given Store?

$this-Store-recursive = 2;
$result = $this-Store-findById($id);

Play with that recursive value until you have the data you need,  
using unbindModel() to eliminate whatever you don't.

-- John



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