chg: [user] virtual field for user settings
parent
0b9b54f14a
commit
b96991cf4a
|
@ -9,6 +9,20 @@ use Authentication\PasswordHasher\DefaultPasswordHasher;
|
||||||
class User extends AppModel
|
class User extends AppModel
|
||||||
{
|
{
|
||||||
protected $_hidden = ['password', 'confirm_password'];
|
protected $_hidden = ['password', 'confirm_password'];
|
||||||
|
|
||||||
|
protected $_virtual = ['user_settings_by_name'];
|
||||||
|
|
||||||
|
protected function _getUserSettingsByName()
|
||||||
|
{
|
||||||
|
$settingsByName = [];
|
||||||
|
if (!empty($this->user_settings)) {
|
||||||
|
foreach ($this->user_settings as $i => $setting) {
|
||||||
|
$settingsByName[$setting->name] = $setting;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $settingsByName;
|
||||||
|
}
|
||||||
|
|
||||||
protected function _setPassword(string $password) : ?string
|
protected function _setPassword(string $password) : ?string
|
||||||
{
|
{
|
||||||
if (strlen($password) > 0) {
|
if (strlen($password) > 0) {
|
||||||
|
|
Loading…
Reference in New Issue