artkost / yii2-qa

[DEPRECATED] The Questions and Answers module inspired by Stack Overflow
http://yii2-qa.artkost.ru/
MIT License
88 stars 29 forks source link

Cannot declare class frontend\models\User, because the name is already in use #38

Open m132418 opened 7 years ago

m132418 commented 7 years ago

my config is 'modules' => [ 'qa' => [ 'class' => 'artkost\qa\Module', 'userNameFormatter' => 'getUserName' ], ],

error report as title.

error raised in this $answerDataProvider->models [vendor/artkost/yii2-qa/views/default/view.php]

JiLiZART commented 7 years ago

Can you provide more information? What version you install. Full stack trace or any additional information?

m132418 commented 7 years ago

yii-advanced-app-2.0.12 user model :frontend/models/User.php implements a method public static function getUserName(){

    if (Yii::$app->user->isGuest)
        return "Guest" ;
    else
    {
        $data =  static::findOne(['id'=>Yii::$app->user->identity->getId(), 'status' => self::STATUS_ACTIVE]) ;
        return $data['username'];
    }
}
m132418 commented 7 years ago

url :http://frontend.all1.dev/qa/default/view?id=1&alias=

PHP Compile Error – yii\base\ErrorException

Cannot declare class frontend\models\User, because the name is already in use

  1. in G:\sites\2017-9\all1\frontend\models\User.php at line 23 14151617181920212223242526272829303132 * @property string $password_hash

    • @property string $password_reset_token
    • @property string $email
    • @property string $auth_key
    • @property integer $status
    • @property integer $created_at
    • @property integer $updated_at
    • @property string $password write-only password */ class User extends ActiveRecord implements IdentityInterface { const STATUS_DELETED = 0; const STATUS_ACTIVE = 10;

    /**

    • @inheritdoc */ public static function tableName()
  2. yii\base\ErrorHandler::handleFatalError() Yii Framework 2017-09-13, 02:25:04

nginx/1.11.5 Yii Framework/2.0.12

m132418 commented 7 years ago

do you have wechat or QQ?