I'm using the boilerplate code from the manual for some basic CRUD
operations, and it's led to a question about how data gets into the
template.
In the "index" method of a controller, you see this:
$this->set('Users', $this->User->findAll());
So, we're explicitly assigning the results of findAll to the "Users"
variable, which is then available in the view as $Users -- this makes
sense.
But in the "edit" method, I see this:
$this->data = $this->User->read();
So we're assigning the results of the "read" method directly to the
data array?
I would expect to see something like this:
$this->set('MyUser', $$this->User->read());
Why the difference in setting view variables? I'm sure there's a
logical reason for this, but can someone tell me what it is?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---