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