When you call Model::read(), the data returned is automatically set in
the Model::$data array. When you call Model::find(), this does not
occur.
Also, with Model::read() you can only scan the model by the id; you
cannot perform complex operations that you can do with Model::find().
Note: Model::read() actually calls Model::find() to obtain the
resultset desired.
-Joel.
On May 25, 10:29 am, Action <[EMAIL PROTECTED]> wrote:
> When is it preferable to useread() instead offind() to query data
> from the database?
>
> In the blog tutorial,read() is used:
>
> $this->Post->id = $id;
> $this->set('post', $this->Post->read());
>
> BUT, I've always just usedfind/ findBy:
>
> $this->set('post', $this->Post->findById($id));
>
> What's the difference?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---