Get action and controller name in Yii model

Hi,

If you want to check current action and controller in model file of Yii.

Then Please use code given below.

1. For getting current action name

$currentAction = Yii::app()->controller->action->id;

2. For getting current controller name

$currentAction = Yii::app()->controller->id;

thanks

Advertisements