[CakePHP] 請問 recursive
同事的程式中有這一句
$this->User->findByEmail($email, null, null, -1)
經翻查 findBy 的章節,help 是這樣寫的
findBy<fieldName>(string $value)
難怪我上次學習 Cake 時,大家看不懂這是什麼
但如果去 trace source code,會發現它真的能動!
(X啦,超過文件的規格可以視為 side effect 呀!!)
好吧,我就繼續 trace,發現 recursive 其實在別的章節找得到文件
比如在 findAll
findAll(string $conditions, array $fields, string $order, int $limit, int
$page, int $recursive)
findAll has been deprecated, use find('all') instead.
這句有趣吧,help 說 findAll 已經不建議使用了
但是 CakePHP 內部還是用它 implement 的,用得很爽
換言之就是 'UnDocument' (應該說文件不推薦才對,因為文件還是把它列出了)
那什麼是 recursive 呢?
Setting the $recursive parameter to an integer forces findAll() to fetch data
according to the behavior described in the Model Attributes $recursive
section outlined earlier. Do not forget to manually add the required foreign
key columns to the $fields array as described there.
以上,整段翻譯對我有些困難 ~^_^~
麻煩講解了
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.219.65.16
→
05/18 20:29, , 1F
05/18 20:29, 1F
→
05/18 20:29, , 2F
05/18 20:29, 2F
→
05/18 20:42, , 3F
05/18 20:42, 3F
→
05/18 20:43, , 4F
05/18 20:43, 4F
→
05/18 20:43, , 5F
05/18 20:43, 5F
→
05/18 20:54, , 6F
05/18 20:54, 6F
→
05/18 20:54, , 7F
05/18 20:54, 7F
→
05/18 20:55, , 8F
05/18 20:55, 8F
→
05/18 20:55, , 9F
05/18 20:55, 9F
→
05/18 20:55, , 10F
05/18 20:55, 10F
→
05/18 21:07, , 11F
05/18 21:07, 11F
→
05/18 21:07, , 12F
05/18 21:07, 12F
※ 編輯: HuangJC 來自: 61.219.65.16 (05/18 21:13)
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):