Getting unknown property: common\models\User::password_hash
in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Component.php at line 147
138139140141142143144145146147148149150151152153154155156
if ($behavior->canGetProperty($name)) {
return $behavior->$name;
}
}
if (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
}
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}
/**
* Sets the value of a component property.
* This method will check in the following order and act accordingly:
*
* - a property defined by a setter: set the property value
* - an event in the format of "on xyz": attach the handler to the event "xyz"
* - a behavior in the format of "as xyz": attach the behavior named as "xyz"
in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 286 – yii\base\Component::__get('password_hash')
in E:\xampp\htdocs\yii2\common\models\User.php at line 153 – yii\db\BaseActiveRecord::__get('password_hash')
147148149150151152153154155156157158159
*
@param string $password password to validate
@return bool if password provided is valid for current user
*/
public function validatePassword($password)
{
return Yii::$app->security->validatePassword($password, $this->password_hash);
}
/**
Generates password hash from password and sets it to the model
@param string $password
in E:\xampp\htdocs\yii2\common\models\LoginForm.php at line 45 – common\models\User::validatePassword('111111')
39404142434445464748495051
@param array $params the additional name-value pairs given in the rule
*/
public function validatePassword($attribute, $params)
{
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError($attribute, 'Incorrect username or password.');
}
}
}
in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\validators\InlineValidator.php at line 72 – call_user_func([common\models\LoginForm, 'validatePassword'], 'password', null, yii\validators\InlineValidator)
Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: common\models\User::password_hash in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Component.php at line 147 138139140141142143144145146147148149150151152153154155156
in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 286 – yii\base\Component::__get('password_hash')
in E:\xampp\htdocs\yii2\common\models\User.php at line 153 – yii\db\BaseActiveRecord::__get('password_hash') 147148149150151152153154155156157158159
*
/**
in E:\xampp\htdocs\yii2\common\models\LoginForm.php at line 45 – common\models\User::validatePassword('111111') 39404142434445464748495051
/**
common\models\LoginForm::validatePassword('password', null, yii\validators\InlineValidator)
in E:\xampp\htdocs\yii2\vendor\yiisoft\yii2\validators\InlineValidator.php at line 72 – call_user_func([common\models\LoginForm, 'validatePassword'], 'password', null, yii\validators\InlineValidator)