我有3个表:如何在cakephp中连接3个表格? (关系)
user:
id;name
usercompany:
id;user_id, company_id
company:
id;company_name
我怎样才能全部3个表连接的蛋糕? 我希望能够看到哪些公司连接到用户。 用户可以属于多个公司。
在用户控制器中,我只是简单地使用$ this-> User-> find(“all”),它应该向我显示与关联公司(包括公司名称)的所有用户。
我该怎么做蛋糕?我应该使用什么,hasandBelongsToMany?感谢您的见解。
你看过[手册](http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html)吗? – arilia