Persisting active model through a redirect()

For my search page, I created a custom SearchForm model to manage all available search parameters. If this model fails to validate in the actionResults() method of my SearchController, the user is redirected back to the initial search page. I’d like the model to persist through this redirect, so I can prefill all the user-entered values again. Right now I’m figuring out how to implement this.

The apparent obvious way is to use CStatePersister. However, I find its documentation a bit scarce. If I save a bit of data, is it linked to the current user session or is it available for all users to retrieve? And I see a save() and load() method in the API, but no delete() or something like that. How can I prevent all those old SearchForm models to clutter up my app?

Another way I thought of was to serialize the SearchForm object and transfer it using Yii::app()->user->set/getFlash(). This would suit my needs perfectly, but it’s obviously a hack. I’d rather not do that if it’s not necessary :)

Any thoughts or pointers to get me started on this?

I know it’s an old post but can you tell us what solution you chose? I’m trying to implement similar functionality.

Cheers,

Matt