m140506_102106_rbac_init::getAuthManager PHP Method

getAuthManager() protected method

protected getAuthManager ( ) : DbManager
return yii\rbac\DbManager
    protected function getAuthManager()
    {
        $authManager = Yii::$app->getAuthManager();
        if (!$authManager instanceof DbManager) {
            throw new InvalidConfigException('You should configure "authManager" component to use database before executing this migration.');
        }
        return $authManager;
    }

Usage Example

 /**
  * Override method to allow injection of used authManager from trait.
  * @return \yii\rbac\DbManager
  */
 public function getAuthManager()
 {
     if ($this->authManager !== null) {
         return $this->authManager;
     }
     return parent::getAuthManager();
 }