2

I have a session variable like this in a controller

$session->set('data', array(
                      'address'=>$form->get('address')->getData(),
                      'detail'=>$form->get('detail')->getData(),
                      'email'=>$form->get('phone')->getData(),
                  ));

I am getting it in another controller like this

$session = $request->getSession();
        $data = $session->get("data");

If I try to access the above session in a twig file it throws exception

{{ app.session.get('data') }} 

Please how do I display the above session data in a twig file Please what could be wrong?

Blaze
  • 2,269
  • 11
  • 40
  • 82

1 Answers1

2

I think you need to do something like this

{% set data = app.session.get('data') %}
{{ data['address'] }}
Shay Altman
  • 2,720
  • 1
  • 16
  • 20