Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
m132418 opened this issue Sep 12, 2017 · 4 comments

Comments

@m132418
Copy link

m132418 commented Sep 12, 2017

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
Copy link
Member

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

@m132418
Copy link
Author

m132418 commented Sep 13, 2017

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
Copy link
Author

m132418 commented Sep 13, 2017

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;

    /**

  1. yii\base\ErrorHandler::handleFatalError()
    Yii Framework
    2017-09-13, 02:25:04

nginx/1.11.5
Yii Framework/2.0.12

@m132418
Copy link
Author

m132418 commented Sep 13, 2017

do you have wechat or QQ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants