Example #1
0
 /**
  * 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 [[Controller::runAction()]] to run the action with the given parameters.
  * If the route is empty, the method will use [[defaultRoute]].
  *
  * @param string $route the route that specifies the action.
  * @param array $params the parameters to be passed to the action
  * @return integer the status code returned by the action execution. 0 means normal, and other values mean abnormal.
  * @throws Exception if the route is invalid
  */
 public function runAction($route, $params = [])
 {
     try {
         return (int) parent::runAction($route, $params);
     } catch (InvalidRouteException $e) {
         throw new Exception("Unknown command \"{$route}\".", 0, $e);
     }
 }