Yii Framework Forum: [EXTENSION] defaultpersister - Yii Framework Forum

Jump to content

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

[EXTENSION] defaultpersister Save/load attribute values as default to session Rate Topic: -----

#1 User is offline   Mike 

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

Posted 26 October 2010 - 09:13 AM

This is an extension that can be used to easily save and load default values of any model. I use it e.g. to save current settings of a filter model to session. Later when a backend user comes back to the page, the same filter settings will be provided for convenience.

Check out the extension page for more details and a full usage example:
http://www.yiiframew...faultpersister/

Questions and suggestions are welcome.
0

#2 User is offline   Mike 

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

Posted 11 January 2011 - 03:47 PM

Updated to 1.1.0:

The extension now also allows to load ActiveRecord attributes that where defined in the model file only.

resetDefaults() can be used to reset (clear) attributes. If no argument is supplied, all values will be cleared. It can also be called with a single attribute name or an array of names that should be cleared.
0

#3 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 11 January 2011 - 04:35 PM

Big congratulations Mike, it is a very useful, very good extension.
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#4 User is offline   Mike 

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

Posted 12 January 2011 - 03:30 AM

Thanks, Antonio.

In fact i really got used to this little helper. For example it's useful if you want to create wizard like forms over multiple pages: I create scenarios for each page and if a page validates i use saveAsDefaults() to remember the form inputs. Only after the last page i call save() to finally store the data to DB. Works like a charm :)
0

#5 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 12 January 2011 - 04:34 AM

View PostMike, on 12 January 2011 - 03:30 AM, said:

In fact i really got used to this little helper. For example it's useful if you want to create wizard like forms over multiple pages: I create scenarios for each page and if a page validates i use saveAsDefaults() to remember the form inputs. Only after the last page i call save() to finally store the data to DB. Works like a charm :)


Impressive...
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

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