本文整理汇总了PHP中yii\console\Controller::runAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::runAction方法的具体用法?PHP Controller::runAction怎么用?PHP Controller::runAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\console\Controller
的用法示例。
在下文中一共展示了Controller::runAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runAction
/**
* Extending runAction to handle extra params loaded dynamically
* by (task) commands requirements or defined in the build script
*
* @inheritdoc
*/
public function runAction($id, $params = [])
{
Log::logger()->addDebug('Executing application command {controller}/{action}', ['controller' => $this->id, 'action' => !empty($id) ? $id : $this->defaultAction]);
if (!empty($params)) {
$options = $this->options($id);
foreach ($params as $name => $value) {
if (!is_int($name)) {
if ($value !== '') {
if (!isset($this->_providedOptions[$name])) {
$this->_providedOptions[$name] = 1;
} else {
$this->_providedOptions[$name]++;
}
}
if (!in_array($name, $options, true)) {
if ($value !== '') {
$this->extraParams[$name] = $value;
}
unset($params[$name]);
}
}
}
}
parent::runAction($id, $params);
}
示例2: runAction
public function runAction($id, $params = [])
{
// Create attributes for all options available for the given API method.
$options = $this->options($id === '' ? $this->defaultAction : $id);
foreach ($options as $option) {
$this->{$option} = '';
}
return parent::runAction($id, $params);
}
示例3: runAction
/**
* Runs an action within this controller with the specified action ID and parameters.
*/
public function runAction($id, $params = [])
{
if (false === empty($params['id'])) {
static::$configAlias = $params['id'];
}
$this->configName = empty(static::$configAlias) ? '' : static::$configAlias;
$this->getConfig();
if (empty(static::$config)) {
throw new InvalidParamException(\Yii::t('yii', 'Unknown daemon ID!'));
}
$this->reloadComponent();
return parent::runAction($id, $params);
}