I have some basic questions about the blog tutorial

1 What does edit($id = null) mean, is $id being reset tot null?
2 What does $this->Post->id = $id; then do, make it null too?
3 Why do we check again if the data is empty, the data validation
prevents it from being empty?

Thanks in advance!

http://book.cakephp.org/view/340/Editing-Posts

function edit($id = null) {
        $this->Post->id = $id;
        if (empty($this->data)) {
                $this->data = $this->Post->read();
        } else {
                if ($this->Post->save($this->data)) {
                        $this->Session->setFlash('Your post has been updated.');
                        $this->redirect(array('action' => 'index'));
                }
        }
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to