tags:

views:

537

answers:

1

like in classic PHP we use the magic variables to start,create session, so how to do that in Symfony.

+5  A: 

It's really easy:

  1. You go to google.com.
  2. You type symfony sessions and hit enter.
  3. You click on the first link.
  4. You search for session on that page, read and learn.

Sorry for possibly sounding rude, but you could save us and yourself a lot of time and hassle, if you start with searching, first - at least for these relatively easy questions (especially regarding frameworks).

And, just to be polite: In your controller, you can access session variables through the user object.

// Get a session value
$name = $this->getUser()->getAttribute('name', 'default_value');
// Set a session value
$this->getUser()->setAttribute('name', $value);
Franz
Many questions on this site could be found by looking up the problem in Google, however I think directing people there would be missing the point. Having a definitive answer which is tagged and which can be kept relevant by wiki edits is of value to the programming community.
Jon Winstanley
Yes, you're right, especially since I gave answers like you to other people who weren't willing to provide the real answer...
Franz
That's why I gave the answer in the end, after googling.. ;)
Franz
Another thing, I have started preferring S.O over google for all programming related questions, even the easy ones [API searches not included], because most of the time, the answers I get here are more useful. I don't know if that was the original intent...
sjobe