[請益] cakephp find 方法會撈出太多table...

看板PHP作者時間14年前 (2011/02/27 17:52), 編輯推噓2(202)
留言4則, 3人參與, 最新討論串1/1
資料表(關聯性都有定) 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

02/28 05:33, , 1F
設定 recursive level; 要抓前先事 bind 或 unbind table
02/28 05:33, 1F

03/01 14:07, , 2F

03/01 14:08, , 3F
可以用 containable 來限制過濾要關聯的Model ...
03/01 14:08, 3F

03/12 09:46, , 4F
感謝
03/12 09:46, 4F
文章代碼(AID): #1DQXxHVc (PHP)
文章代碼(AID): #1DQXxHVc (PHP)