Yii Framework Forum: Subactions Using One Class - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Subactions Using One Class Rate Topic: -----

#1 User is offline   Gasim 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-June 11

Posted 11 April 2014 - 09:22 AM

I want to extend my controller to handle the following scenario:

I have two controllers: Contract and Subject; each of them has their own set of actions etc. Then each of these controllers will have a set of actions called "template" where the template has "view", "preview", "previewHtml", "generate" and will use the same logic with some slight name differences. So I searched in the internet and got into this article: http://www.yiiframew...e-with-caction/ which is almost what I am looking for but with one slight difference. I want to be able to call something like:


public function actions() {
	return [
		'template'=>[
			'name'=>'Contract',
			'class'=>'BContract',
			'templateName'=>'ContractTempl'
		]		
	];	
}



and it will load all the template actions but they will belong to the the controller that loaded/called them. The reason I need this is because controller has a lot of behaviors that handle logs, rbac, some view related stuff and I need the actions to "belong" to the controller not just be their own module, controller, or action.

How can I achieve that? This needs to be an interface that can handle any "actionset"?
Sincerely,
Gasim Gasimzada
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users