Hey, I've tried to upgrade from Yii 105 to Yii 106 and found out the follow situation:
The action ApprovePost doesn't work on Yii 106
in Post model:
/**
* @approves a particular post
*/
public function approve()
{
$this->postStatus = Post::STATUS_PUBLISHED;
if ( $this->save() ) {
return true;
}
}
in PostController
public function actionApprovePost()
{
if(Yii::app()->request->isPostRequest){
$post=$this->loadPost();
if ( $post->approve() )
{
$this->redirect(array('list'));
}
}
else
throw new CHttpException(500,'Nice try.');
}
in view post/list
[<?php echo ($model->postStatus != Post::STATUS_PUBLISHED)? CHtml::linkButton('Publish',array('submit'=>array('approvePost','id'=>$model->postId),'confirm'=>'Sure?')):'Published'; ?>]
[<?php echo ($model->postStatus != Post::STATUS_ARCHIVED) ? CHtml::linkButton('Archive',array('submit'=>array('archivePost','id'=>$model->postId,'status'=>$status),'confirm'=>'Sure?')):'Archived'; ?>]
When I click Publish or Archive, the system just reloads the page, it performs the action in model Post, but status is not updated. Even if I enter the Modify page and click the activeDropDownList to change the status value, the value is not saved…
I changed to Yii 105 back and it works great…
cheers