本文整理汇总了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);
}