__construct() public method

Constructor.
public __construct ( string $id, Controller $controller, array $config = [] )
$id string the ID of this action
$controller Controller the controller that owns this action
$config array name-value pairs that will be used to initialize the object properties
Esempio n. 1
0
 public function __construct($id, $controller, $config = [])
 {
     parent::__construct($id, $controller, $config);
     if (is_array($this->sort) && !isset($this->sort["class"])) {
         $this->sort["class"] = Sort::className();
         $this->sort = \Yii::createObject($this->sort);
     }
     if ($this->sort == null) {
         $this->sort = \Yii::createObject(Sort::className());
     }
     if ($this->searchModelClass == null && class_exists($this->modelClass . "Search")) {
         $this->searchModelClass = $this->modelClass . "Search";
     }
 }
Esempio n. 2
0
 public function __construct($id, $controller, $config = [])
 {
     $controller->enableCsrfValidation = false;
     parent::__construct($id, $controller, $config);
 }
Esempio n. 3
0
 /**
  * @param string $id the ID of this action
  * @param Controller $controller the controller that owns this action
  * @param string $actionMethod the controller method that this inline action is associated with
  * @param array $config name-value pairs that will be used to initialize the object properties
  */
 public function __construct($id, $controller, $actionMethod, $config = [])
 {
     $this->actionMethod = $actionMethod;
     parent::__construct($id, $controller, $config);
 }
 /**
  * @param string $id the ID of this action
  * @param Controller $controller the controller that owns this action
  * @param string $actionMethod the controller method that this inline action is associated with
  * @param array $config name-value pairs that will be used to initialize the object properties
  */
 public function __construct($id, $controller, $actionMethod, $config = [])
 {
     // 传入action的id,controller的实例,action方法的名称以及action的配置
     $this->actionMethod = $actionMethod;
     parent::__construct($id, $controller, $config);
 }
Esempio n. 5
0
 /**
  * 重写Constructor,增加参数的初始化处理
  *
  * @param string $id
  *            the ID of this action
  * @param Controller $controller
  *            the controller that owns this action
  * @param array $config
  *            name-value pairs that will be used to initialize the object properties
  */
 public function __construct($id, $controller, $config = [])
 {
     //初始化modelClass
     if (empty($this->modelClass)) {
         if (isset($controller->modelClass) && !empty($controller->modelClass)) {
             $this->modelClass = $controller->modelClass;
         } else {
             throw new InvalidConfigException("modelClass of action {$id} can not be empty!");
         }
     }
     if (!class_exists($this->modelClass)) {
         throw new InvalidConfigException("modelClass {$this->modelClass} dosen't exist!");
     }
     //初始化跳转地址
     if (empty($this->redirectRoute)) {
         if (isset($controller->redirectRoute) && !empty($controller->redirectRoute)) {
             $this->redirectRoute = $controller->redirectRoute;
         } else {
             $this->redirectRoute = '/' . $controller->module->id . '/' . $controller->id . '/index';
         }
     }
     parent::__construct($id, $controller, $config);
 }
Esempio n. 6
0
 /**
  * @param string $id
  * @param Controller $controller
  * @param ConfigInterface $flowConfig
  * @param array $config
  */
 public function __construct($id, $controller, ConfigInterface $flowConfig, $config = [])
 {
     $this->flowConfig = $flowConfig;
     parent::__construct($id, $controller, $config);
 }