mdmsoft / yii2-admin

Auth manager for Yii2 (RBAC Manager)
GNU General Public License v3.0
1.16k stars 577 forks source link

Setting unknown property: mdm\admin\models\User::status #443

Closed ageurtse closed 4 years ago

ageurtse commented 4 years ago

Hello,

i installed them rbac manager and usermanager on a clean install. but when i go to http://localhost/admin/user/signup

and fill in all the fields, i get this strange error. what or where do i have to look ?

`1. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\Component.phpat line 209 200201202203204205206207208209210211212213214215216217218 $behavior->$name = $value; return; } }

    if (method_exists($this, 'get' . $name)) {
        throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
    }

    throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);
}

/**
 * Checks if a property is set, i.e. defined and not null.
 *
 * This method will check in the following order and act accordingly:
 *
 *  - a property defined by a setter: return whether the property is set
 *  - a property of a behavior: return whether the property is set
  1. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 324– yii\base\Component::__set('status', 10)
  2. in C:\xampp\htdocs\yii\vendor\mdmsoft\yii2-admin\models\form\Signup.php at line 57– yii\db\BaseActiveRecord::__set('status', 10) 51525354555657585960616263 { if ($this->validate()) { $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; $user = new $class(); $user->username = $this->username; $user->email = $this->email; $user->status = ArrayHelper::getValue(Yii::$app->params, 'user.defaultStatus', UserStatus::ACTIVE); $user->setPassword($this->password); $user->generateAuthKey(); if ($user->save()) { return $user; } }
  3. in C:\xampp\htdocs\yii\vendor\mdmsoft\yii2-admin\controllers\UserController.php at line 152– mdm\admin\models\form\Signup::signup() 146147148149150151152153154155156157158 @return string / public function actionSignup() { $model = new Signup(); if ($model->load(Yii::$app->getRequest()->post())) { if ($user = $model->signup()) { return $this->goHome(); } }

    return $this->render('signup', [
            'model' => $model,
  4. mdm\admin\controllers\UserController::actionSignup()
  5. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\InlineAction.php at line 57– call_user_func_array([mdm\admin\controllers\UserController, 'actionSignup'], [])
  6. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\Controller.php at line 180– yii\base\InlineAction::runWithParams([])
  7. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\Module.php at line 528– yii\base\Controller::runAction('signup', [])
  8. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\web\Application.php at line 103– yii\base\Module::runAction('admin/user/signup', [])
  9. in C:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\Application.php at line 386– yii\web\Application::handleRequest(yii\web\Request)
  10. in C:\xampp\htdocs\yii\web\index.php at line 12– yii\base\Application::run() 6789101112 require DIR . '/../vendor/autoload.php'; require DIR . '/../vendor/yiisoft/yii2/Yii.php';

$config = require DIR . '/../config/web.php';

(new yii\web\Application($config))->run(); $_POST = [ '_csrf' => 'g4t0PDkS225GY3u5tTVH3CA2M9L1cjF2pmT4mZ9tunPyxiJQUEexGSwvPtTMfA67FlR85rE2UyDvF8rurCbTNA==', 'Signup' => [ 'username' => 'xxxxxxxx', 'email' => 'xxxx@xxxxx.xx', 'password' => '12345678', 'retypePassword' => '12345678', ], 'signup-button' => '', ];

$_COOKIE = [ 'PHPSESSID' => 'mu6s9lemlgsq0lkftorrqn3kst', '_csrf' => '9b0d3c282e70ff118453e856ca2645660d2aaa044969282ae5cac5ccda5666cda:2:{i:0;s:5:"_csrf";i:1;s:32:"qMVliUjwjLEmyIIg6bO4DDbVIs2w3KiG";}', ];

$_SESSION = [ '__flash' => [], ];`

ageurtse commented 4 years ago

Looking at this post, found the solution myself.

my user table was not right, somehow the migration didn't notify me on that. There was no status field in the table.

redo all the migrations and now it runs ok.