Update Yii2 framework to the latest version

This commit is contained in:
ErickSkrauch
2019-06-18 02:33:20 +03:00
parent e4804e0cdd
commit 31069562b3
7 changed files with 75 additions and 29 deletions

View File

@ -6,6 +6,7 @@ namespace api\modules\authserver;
use Yii;
use yii\base\BootstrapInterface;
use yii\web\NotFoundHttpException;
use yii\web\Response;
class Module extends \yii\base\Module implements BootstrapInterface {
@ -13,7 +14,7 @@ class Module extends \yii\base\Module implements BootstrapInterface {
public $defaultRoute = 'index';
public function beforeAction($action) {
public function beforeAction($action): bool {
if (!parent::beforeAction($action)) {
return false;
}
@ -23,10 +24,18 @@ class Module extends \yii\base\Module implements BootstrapInterface {
return true;
}
public function afterAction($action, $result) {
if ($result === null) {
Yii::$app->response->format = Response::FORMAT_RAW;
}
return parent::afterAction($action, $result);
}
/**
* @param \yii\base\Application $app
*/
public function bootstrap($app) {
public function bootstrap($app): void {
$legacyHost = $app->params['authserverHost'];
$app->getUrlManager()->addRules([
"//{$legacyHost}/authserver/auth/<action>" => "{$this->id}/authentication/<action>",