How to unset YII::$app->request->post() after call $model->load()?

How to unset YII::$app->request->post() after call $model->load()?

It needs because I call action inside the same action after post for reload data in view

my action


public function actionPosts($theme_id){

	$query = sprintf("select * from v_forum_posts where theme_id = %d", $theme_id);

	$posts = Yii::$app->db->createCommand($query)->queryAll();	

	

	$model = new PostForm();

		

	if($model->load(YII::$app->request->post())){

		$user_id = Yii::$app->user->identity->getId();

			

		$model->user_id = $user_id;

		$model->validate();

		$model->save();	

			

		//here YII::$app->request->post() must be deleted

		//or records will be added to table in cycle

			

		return Yii::$app->runAction('forum/posts',['theme_id'=>$theme_id]);

	}

			

	return $this->render('posts', ['model'=>$model, 'posts'=>$posts);

}

This is a very bad solution. I think you should split your action code into almost two parts.

But if you can’t, you could try (I don’t know if it works):




$_POST = array();



Unfortunately this doesn’t work. $model->load(YII::$app->request->post()) return true.