[TYPO3-mvc] Extending Tx_Extbase_Domain_Model_FeUser with some kind of session object

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Tue Jan 19 23:14:38 CET 2010


Hello!

For the meanwhile I came up storing needed session data manually using
the tslib_feUserAuth::setKey() and tslib_feUserAuth::getKey() methods.

For objects I serialize on setting, and deserialize on getting them,
which works quite well imho.

Thomas


Nathan Lenz schrieb:
> Thomas "Thasmo" Deinhamer wrote:
> 
>> I thought of creating a kind of 'session object' put
>> onto the FeUser Model, which 'persists' all kind of
>> data not into the database, but rather into the session.
>>
>> After the user logs in, needed session data will be transformed
>> and/or cloned/copied into a FeUser object or will be persisted.
>>
>> I'm not sure if this is the best way. And if, I'm not quite sure
>> how to create such kind of session user object which will store
>> data in the session. (Maybe it's just a wrapper class over the
>> FeUserAuth class of TYPO3, I'm not sure.)
> 
> I need to solve this same problem in the next few days.
> 
> I was thinking about creating a session enabled repository for the
> object I need to persist into the session.  Then the controller would
> just add,update,remove,etc... the object from the customized repository.
>  The repository would handle the logic of deciding if it needs to
> persist the object to the database or the session. However, I'm not sure
> this makes sense.  It doesn't matter to me where the data is persisted,
> just as long as it is available and I can access it.
> 
> Another idea would be to add an "owner" property to the basket object.
> Then add a findByOwner() method to the basketRepository. I'm not sure if
> it's possible to make "owner" either a session id or a FeUser object.
> 
> Your Basket controller would then do the logic:
> 
> Basket->showAction() {
>     owner = '';
>     if (feUser exists) {
>         owner = feUser
>     } else if (sessionId exists) {
> 	owner = sessionID
>     } else {
> 	no basket! why don't you create one.
>     }
> 
>     view->assign('basket',$repos->findByOwner(owner));
> }
> 
> In this case, baskets would be always persisted to the database.
> 
> I'm not sure how I'm going to do it yet.
> --Nathan


More information about the TYPO3-project-typo3v4mvc mailing list