when I use bake.php to make the controller code and I can understand
part of them that I add //problem? with the code.
if the $this->data is empty ,why bother to test the
$this->data['Tag']???
FIY the bossz hasAndBelongsToMany tag
function edit($id = null)
{
if(empty($this->data)) // here test the data
{
if(!$id)
{
$this->Session->setFlash('Invalid id for
Bossz');
$this->redirect('/bosszs/index');
}
$this->data = $this->Bossz->read(null, $id);
$this->set('tags', $this->Bossz->Tag->generateList());
if(empty($this->data['Tag'])) { $this->data['Tag'] =
null; } //
problem?why bother test data['tag']
$this->set('selectedTags',
$this->_selectedArray($this->data['Tag']));// problem?
}
else
{
$this->cleanUpFields();
if($this->Bossz->save($this->data))
{
$this->Session->setFlash('The Bossz has been
saved');
$this->redirect('/bosszs/index');
}
else
{
$this->Session->setFlash('Please correct errors
below.');
$this->set('tags',
$this->Bossz->Tag->generateList());
if(empty($this->data['Tag']['Tag'])) {
$this->data['Tag']['Tag'] =
null; } // problem?
$this->set('selectedTags',
$this->data['Tag']['Tag']);
}
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---