jasny/auth

Storing the user object in a session?

pv4 opened this issue · 1 comments

pv4 commented

Hello!

According to

if ($uid === null || $uid instanceof User) {
it's somehow possible to store the User instance in a session instead of storing uid only.

I'd like to use this feature to get rid of extra sql query in Storage::fetchUserById() (i.e. get the User from the session instead of doing an extra sql query(-ies) to get the User from database by uid). But I couldn't find a way to force Jasny/Auth to put the User to the session instead of only putting uid there.

  1. Is there such a way?
  2. Is there actually such a feature, or did I misunderstand what that "$user instanceof User" is for?