Yii Webapp Autogenerated Files Should Not Use "_Post"

When generating a webapp using yiic tool the site controller has a function that looks like this:




public function actionLogin()

	{

		...

		// collect user input data

		if(isset($_POST['LoginForm']))

		{

			$model->attributes=$_POST['LoginForm'];

			...

		}

		...

	}



I think these autogenerated files should use the suggested yii functions to get request variables. I rewrote the function so it looks like this:




public function actionLogin()

	{

		...

		// collect user input data

                $request = Yii::app()->request;

		if($request->getPost('LoginForm'))

		{

			$model->attributes=$request->getPost('LoginForm');

			...

		}

		...

	}



As a new user I can say that I try to mimic the way the code is written by copying/pasting code that yii already wrote. In this case I started getting all request variebles with $_POST and $_GET and I did not learn until now that there is a better way of doing it.

My suggestion for the next yii release is the change those autogenerated files so that "$request->getPost" is used instead of $_POST, etc…

The only difference between $_POST and getPost is the optional default value (or null).

Does it really worth it?..

Well, in my opinion, it would allow people new to the framework to know that the function "getPost" exists without having to read extensive documentation. It is kind of funny that the framework has a function to get request variables but instead of using it, uses something else.