本文整理匯總了PHP中yii\base\Action::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Action::__construct方法的具體用法?PHP Action::__construct怎麽用?PHP Action::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\base\Action
的用法示例。
在下文中一共展示了Action::__construct方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
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";
}
}
示例2: __construct
public function __construct($id, $controller, $config = [])
{
$controller->enableCsrfValidation = false;
parent::__construct($id, $controller, $config);
}
示例3: __construct
/**
* @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);
}
示例4: __construct
/**
* 重寫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);
}
示例5: __construct
/**
* @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);
}