views:

317

answers:

2

When using CakePhp would it be advisable to set recursive = -1 in the AppModel class and then use the Containable Behaviour whenever you need a deeper data relationship?

I believe this would give my applications the best chance of avoiding database related sluggish performance but is the methodology sound?

Thanks

Leo

+2  A: 

I use the Containable behaviour on every query. If there is no need for a deeper relationship I use $params['contain'] = array(); -> I don't use recursive at all anymore

harpax
+1  A: 

leo i see what you are trying to do, and its a pretty good idea, but what i prefer to do on all my relations is set the fields for each relation, so i would just pull the name and id.

this way you have the data and the joins are not to bad.

dogmatic69