» Extending the Symfony2 sessionTweet this
Hi symfonians !
If you are used to symfony1, you probably noticed that you don't have a
myUser class to handle the user session. It's generally useful so you don't have to handle directly with session attributes and you can also have shortcuts. Well it's quiet easy to have such a class in Symfony2:
Declare your own session class as the framework level in your
app/config.yml config file:
And now create your own mySession class which extends the default Symfony2 session class:
And your done.
PS: The class can be stored in another location, I'm not sure which is the best ?
PS2: The service could also be loaded at the Bundle level.