开发者

CakePHP - Set recursive to -1 in AppModel then use Containable behaviour as appropriate

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 da开发者_C百科ta relationship?

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

Thanks

Leo


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜