作者sdallan ()
看板PHP
标题[请益] cakephp find 方法会捞出太多table...
时间Sun Feb 27 17:52:14 2011
资料表(关联性都有定)
user_courses( user_id , course_id )
courses( id )
users( id )
chapters( id , course_id )...
我下了一个查询
$this->userCourse->find('all',user_id = "xxx");
cakephp 很聪明的帮我把 course > chapter 的资料都拉出来了
可是...也很聪明的把 user 的资料也拉了出来...
请益是否可以在捞资料的时候,使他不捞特定某张表的资料呢?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.127.72.91
1F:推 Huangs:设定 recursive level; 要抓前先事 bind 或 unbind table 02/28 05:33
3F:→ kylekai:可以用 containable 来限制过滤要关联的Model ... 03/01 14:08
4F:→ sdallan:感谢 03/12 09:46