Users.php (model):
...
public function hashPassword($password){
$hashed = hash('sha256', $password . self::HASH_CODE);
return $hashed;
}
...
UserIdentity.php
...
else if($user->password!==Users::hashPassword($this->password))
...
Error:
Non-static method Users::hashPassword() should not be called statically, assuming $this from incompatible context
You’ll need to define
hashPassword()as a static function in order to call it withUsers::hashPassword():Otherwise, you can create an instance of the
Usersclass and call it in a non-static manner:In a strictly-
yiisense, you may be able to call it with the following (depending on your setup):