开发者

What is the difference between $this->Cake->findById(7); and read(

What is the difference between these 2 commands in Cakephp?

$this->Model->findbyId(7);
$this->Model->read(null, 7);

I am 开发者_C百科trying to improve my Cakephp code and wonder what the best way is to request individual items from the database, e.g. for /view/$id.

Should I use findbyId or read()? I have even seen people use find('first') with an id=$id condition.


read() sets the model data. There's some good info at http://nuts-and-bolts-of-cakephp.com/2008/06/13/read-vs-find/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜