runAction() public method
Runs a controller action specified by a route.
This method parses the specified route and creates the corresponding child module(s), controller and action instances. It then calls yii\console\Controller::runAction() to run the action with the given parameters. If the route is empty, the method will use $defaultRoute.
For example, to run public function actionTest($a, $b)
assuming that the controller has options the following code should be used:
\Yii::$app->runAction('controller/test', ['option' => 'value', $a, $b]);
public integer|yii\console\Response runAction ( $route, $params = [] ) | ||
---|---|---|
$route | string |
The route that specifies the action. |
$params | array |
The parameters to be passed to the action |
return | integer|yii\console\Response |
The result of the action. This can be either an exit code or Response object. Exit code 0 means normal, and other values mean abnormal. Exit code of |
throws | yii\console\Exception |
if the route is invalid |
Please login to continue.