I have build a form in D8 and on submit I want to save the form values into a session, so that I can access them 3, 4,.... page requests later. In D7 I just used
$_SESSION['key'] = $value
I have a feeling, in D8 and symfony, this is (very) bad practice. How should I solve this? At the moment I'm using the following chunk of code, but I don't know if this is the correct way:
$session = new Session();
$session->set('name', 'value');
$name = $session->get('name');