My question is that I don’t want to access them using request->getParam(‘country’) in my models and controllers, I want these two parameters to be Application parameters
Example, I would like to access Yii::app()->countryYii::app()->language
How could I make those to request parameters app level vairalbes :-).
Create a file ApiBehavior.php in protected/components.
But Yii::app()->language is reserved by Yii.
I would call the behavior methods ‘apiCountry’ and ‘apiLanguage’.
class ApiBehavior extends CBehavior
{
public function getApiCountry()
{
return $this->getOwner()->request->getParam('country'); //or Yii::app()->request->getParam('country');
}
public function getApiCountry()
{
return $this->getOwner()->request->getParam('language'); //or Yii::app()->request->getParam('language');
}
Add this component to the application behaviors in config/main.php