I am using a custom finder for the ‘Authentication.Password’ Identifier so that the logged in user contains associated data.
One of the association is the profile which is an extra table. The profile has a blob field for the user picture.
When I try to get a user by $this->Users->get($id, [‘contain’ => ‘…’]) everything is fine. I can use the blob data and if i do a debug($user), the profile field for the avatar shows ‘‘avatar’ => (resource) Resource id #28’.
However, if I access the logged in users profile by ‘$this->Identity->get(‘profile’)’ and debug the entity, the field only shows '‘avatar’ => (int) 0) and I am not able to use the blob data (since it is simply not there)
So at the moment I need to get the id from the logged in user by ‘$this->Authentication->getIdentity()’ and then use the id with $this->Users->get($id, [‘contain’ => ‘…’]) to have the valid data.
But this seems kind of wrong since i would assume that the correct way is to load the association in the custom finder for the identifier…