Where to store temporary variables

Hi,

I have run into the following problems which both raise the same question:

  • 1.) I have a very large database of items which can be filtered. If a user gets into the view of a specific object, I want to offer back/forward buttons which reflect these filters.

  • 2.) User can start update process for items from different starting points (start page, detail page, list) and I want him to return to the page where he started the action in the first place.

Where would I store values which reflect filter settings and starting point of the operations ideally?

I have come up with three places which do not seem to be ideal to me:

  • simple GET / POST passtrough: I just do not like it because it means manually exposing the variables on each page the user could visit.

  • saving it to the model of the item on which operations are performed: but as the startpage or filter settings are not really connected to the model of the item, I do not feel like putting it there.

  • putting it into the Controller component: This would work as it is globally available via $this->key, but it would mean crowding this very object with loads of stuff, if I used it extensively.

Any suggestions how to achieve a better style here?

Thanks in advance

Simon

I’ve written an extension for this. But frankly speaking it is rather a proof of concept than something i use much in my applications. But maybe it gives you some ideas:

http://www.yiiframework.com/extension/xreturnable/