I’ve installed cinghie/yii2-user-extended (dektrium/yii2-user) and it’s working well but there’s a need to add custom functions to the User model (getGroup). What is the proper way to do this without losing all the changes after an extension update? Should I make a new model extending yii2-user?
in config\web model map ‘User’=> ‘app\models\User’ instead of the one to cinghie’s User
app\models\User:
<?php
namespace app\models;
use Yii;
use cinghie\yii2userextended\models\User as BaseUser;
use yii\db\Query;
class User extends BaseUser
{
public function getText()
{
return 'test text';
}
}
but I can’t figure out how to reach it (calling unknown method)
Yii::$app->user->identity->getText() tries to get the method from dektrium\user\models\User::getText()
and
Yii::$app->user->getText() from yii\web\User::getText(), which should be the right place but still says the method is unknown.