I have an article and tag model.. when i saved an article with tags it
works fine, but i made a publish / unpublish function like below, but
when i use it all habtm relations are deleted how can i prevent this?
public function admin_publish($id)
{
$data = $this->Article->read('published', $id );
if( false === $data )
{
return 0;
}
$other = $data['Article']['published'] == 0 ? 1 : 0;
if( true == $this->Article->saveField('published', $other ) )
{
if($other == 1) {
$publish_text = 'published';
} else {
$publish_text = 'unpublished';
}
$this->Session->setFlash("Your article has been
$publish_text.");
$this->redirect('index');
} else {
$this->Session->setFlash('Your article could not be
published.');
$this->redirect('index');
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---