作者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