0

I have two controller files in my project. In first one, LoginProfileController, and inside LoginProfileAction function, I write:

$session = new Session();
$session->start();

Then, I need to access the same session object in other file. Since Symfony doesn't support $_SESSION Variable, how can I do that?

Caconde
  • 4,177
  • 7
  • 35
  • 32
Lakmal Vithanage
  • 2,767
  • 7
  • 42
  • 58
  • 1
    this answer might be helpful. [How to use Sessions in Symfony?](http://stackoverflow.com/questions/1761552/how-to-use-sessions-in-symfony) – Nikitas Dec 01 '13 at 06:20
  • Why you create a new session? Use the existing session in the request! – Emii Khaos Dec 01 '13 at 10:41

1 Answers1

0

Symfony Session is a wrapper to native php $_SESSION array. Just instantiate new $session object wherever you need it and you will have access to your session data.

Have a look at: http://symfony.com/doc/current/components/http_foundation/sessions.html

BTW behind the scenes symfony uses the $_SESSION array.

Arek S
  • 4,239
  • 4
  • 24
  • 33