TokenInterface Attributes VS Session Attributes #54944
Unanswered
michitheonlyone
asked this question in
Q&A
Replies: 1 comment
-
Heres an example Controller that works fine in both ways: class ExampleController extends AbstractController
{
#[Route('/example', name: 'example')]
public function index(TokenInterface $token, Request $request): Response
{
$token->setAttribute('tokenAttribute', 'tokenValue');
$request->getSession()->set('sessionAttribute', 'sessionValue');
dd($token->getAttribute('tokenAttribute'), $request->getSession()->get('sessionAttribute'));
// ---
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i came across the TokenInterface and wanted to know whats the diffrence of attributes stored by the TokenInterface vs the ones stored in the session? They get distroyed when the user logs out but where do they get stored?
i would like to store some extra user data (available and cachable as long as the user is present) like a group id, avatar url etc.. but where to store them?
Beta Was this translation helpful? Give feedback.
All reactions