Our standard practice for efficiency, consistency, and of course minimal extra 
code, is 

 

-          to define all model associations in our model: You would soon get 
sick of binding them all on the fly, you could of course come up with a custom 
behavior or similar to do it in short hand via your query params etc

-          set recursive to -1 in your model: means you get no related data and 
have to specify via containable or recursive params of your query what your 
after, but you don’t get swamped with all the data all the time

 

This works pretty well for us, and is possibly reasonably common practice(if I 
should be so bold to assume) and once you have it in your head that you have to 
specify related data in your queries your away laughing.

 

Paul

 

From: [email protected] [mailto:[email protected]] On Behalf Of 
Chad Casselman
Sent: Sunday, January 18, 2009 5:16 AM
To: [email protected]
Subject: Associations on the Fly - Good or Bad?

 

Are there any known advantages or disadvantages of 
1) doing all associations ONLY when needed and only the ones that are needed
or
2) putting lots of associations in the models and trying to unbind / contain 
them out of the urls ?


Just trying to find a consistent way to get the most out of the applications.

Chad






No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.10.8/1899 - Release Date: 1/17/2009 5:50 
PM


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

Reply via email to