How to override/extend
the namespace methods
, with using \Yii::$classMap
I want to override/extend
the beforeAction($action)
method for yii\base\Controller
, like this.
namespace yii\web;
class Controller extends \yii\web\Controller
{
public function beforeAction($action)
{
return parent::beforeAction($action);
}
// Here all the parent methods in \yii\web\Controller should be available
}
And now in backend/web/index.php
\Yii::$classMap['yii\web\Controller'] = '@common/classMaps/Controller.php';
And now in backend/controllers/MyController
,
namespace backend/controllers;
class MyController extends \yii\web\Controller
{
public function actionIndex()
{
}
}
How it should be done??