/** * Runs this action with the specified parameters. * This method is mainly invoked by the controller. * @param array $params action parameters * @return mixed the result of the action */ public function runWithParams($params) { $args = $this->controller->bindActionParams($this, $params); Application::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Application::$app->requestedParams === null) { Application::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); }
/** * Runs this action with the specified parameters. * This method is mainly invoked by the controller. * * @param array $params the parameters to be bound to the action's run() method. * @return mixed the result of the action * @throws \ErrorException if the action class does not have a run() method */ public function runWithParams($params) { if (!method_exists($this, 'run')) { throw new \ErrorException(get_class($this) . ' must define a "run()" method.'); } $args = $this->controller->bindActionParams($this, $params); Application::trace('Running action: ' . get_class($this) . '::run()', __METHOD__); if (Application::$app->requestedParams === null) { Application::$app->requestedParams = $args; } $result = call_user_func_array([$this, 'run'], $args); return $result; }