How do I write a join query across multiple tables in CakePHP?

后端 未结 6 1685
既然无缘
既然无缘 2020-11-28 07:50

can anyone tell me, how to retrieve joined result from multiple tables in cakePHP ( using cakePHP mvc architecture). For example, I have three tables to join (tbl_topics, tb

6条回答
  •  清歌不尽
    2020-11-28 08:25

    What you need is recursive associations support, which is not possible with stock CakePHP currently.
    Although it could be achieved using some bindModel trickery
    or an experimental RecursiveAssociationBehavior.

    Both of these solutions will either require you to use extra code or rely on a behaviour in your application but if you resist the temptation to write pure SQL code, you'll be rewarded with being able to use Cake`s pagination, auto conditions, model magic etc..

提交回复
热议问题