/** * 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); }
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); }
/** * 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); }