Hi Yii’ers!
So I have quite a few controller actions in various apps which container multiple words.
For example:
public function actionPersonalInfo
And:
public function actionBillingDetails
At present the url to get to these is:
mysite.com/module/controller/billingDetails
Ideally I would like this to be:
mysite.com/module/controller/billing-details
I understand I can create url routes but I don’t want to do this for every action.
At the moment I am able to achieve this by overriding the createAction function in CBaseController using the following:
public function createAction($actionID)
{
if(($action=parent::createAction($actionID))===null && strpos($actionID, '-') !== false){
require_once Yii::getPathOfAlias('app.vendors.Zend.Filter').'.php';
$newActionID = Zend_Filter::filterStatic($actionID, 'Word_DashToCamelCase');
if(method_exists($this,'action'. $newActionID)){
return new CInlineAction($this,$newActionID);
}
}else{
return $action;
}
}
So to get to the question.
Is there a neater way to accomplish the same thing without overriding the core functions?