[TYPO3-mvc] session handling in extbase
Michael Knoll
mimi at kaktusteam.de
Sat Jul 23 13:44:16 CEST 2011
Hi Thomas,
this is a little tricky at the moment, as we do not have a factory that
can handle fe / be sessions. So if you take a look at the yag abstract
controller:
https://github.com/michaelknoll/yag/blob/master/Classes/Controller/AbstractController.php
you see how to initialize the lifecycle manager.
We inject the session persistence manager into every object that needs
to be persisted. This is not yet very well refactored, but at the moment
it works like this:
1. A factory builds the session-persisted object and injects a session
persistence manager
2. The object registers itself in the session persistence manager and
gets injected its session data from the last run
3. When the lifecycle finishes (TYPO3 shuts down), session persistence
manager grabs session data from each registered object and stores it to
the session handler - this can be different handlers, concerning fe or
be session handling.
Take a look at
https://github.com/daniellienert/pt_extlist/blob/master/Classes/Domain/Model/Filter/FilterFactory.php
for a factory.
The controller only instantiates the lifecycle manager, session
persistence manager has its own factory that handles getting a singleton
instance, whenever you need an instance.
Hope, this helps you. Feel free to ask if you have any further questions.
The extensions pt_extlist (
https://github.com/daniellienert/pt_extlist) and yag (
https://github.com/michaelknoll/yag) use these classes at the moment, so
perhaps you can have a look there. Documentation is on the way, as soon
as we have the whole thing refactored and nice.
Greez
Mimi
Am 23.07.11 12:42, schrieb Thomas "Thasmo" Deinhamer:
> Michael Knoll schrieb:
>> we did not really implement a session persistence the FLOW3 way, but
>> coped this problem by having a session persistence manager that persists
>> object data of objects that implement a certain interface. If you are
>> interested in that stuff, take a look at
>
> Hey, thanks for your input.
> Unfortunately I'm struggling how to
> use your classes in controllers.
>
> Is there any example or documentation?
>
> Thanks a lot,
> Thomas
More information about the TYPO3-project-typo3v4mvc
mailing list