How to replicate:
After $result->isValid()
$currentSession = $this->Authentication->getIdentity();
pr($currentSession);
It shows :
Authentication\Identity Object
(
[config] => Array
(
[fieldMap] => Array
(
[id] => id
)
)
[data] => App\Model\Entity\User Object
(
[id] => 1
[email] => test@example.com
[password] => $2y$10$lJmWmCJuneg9O3AD2KsfI.qER7UQEBJn1ihnHA4pyKdUmX3TrCFUO
[activeToken] => 83s6f9e1d6a8d1f85d2f4d9a3as1c8
[token] => 56asd546a8s5d484fd156dsf98f56ew12
[[new]] =>
[[accessible]] => Array
(
[username] => 1
[profiles] => 1
)
[[dirty]] => Array
(
)
[[original]] => Array
(
)
[[virtual]] => Array
(
)
[[hasErrors]] =>
[[errors]] => Array
(
)
[[invalid]] => Array
(
)
[[repository]] => Users
)
)
In User.php I have:
protected $_hidden = [
'password',
'activeToken',
'token'
];
Question
Is there a way I can remove “Password” from [data]
?