Yii Framework Forum: Where to store temporary variables - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Where to store temporary variables

#1 User is offline   SimonB 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 14-March 10

Posted 04 September 2010 - 03:03 AM


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


#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,017
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 06 September 2010 - 01:23 AM

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:


Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users