had to create this for a project I'm working on, its useful for me, don't know if someone else would find it useful. but hey beats rewriting the same stuff in the models over and over.
* CSerializeBehavior allows a model to specify some attributes to be
* arrays and serialized upon save and unserialized after a Find() function
* is called on the model.
* public function behaviors()
* return array(
* 'CSerializeBehavior' => array(
* 'class' => 'application.extensions.CSerializeBehavior',
* 'serialAttributes' => array('validator_options'),
then $model = new Model;
$model->example_attribute = array('fun');
// internally now example_attribute is saved into db as a serialized array
then $model = Model::model()->find(1);
 => fun
Page 1 of 1
CSerializeBehavior new extension
Posted 04 June 2010 - 01:43 AM
Very nice: first post and already giving. Thanks for sharing!
- You can upload your extension to the extension repository. But you might need some posts here in the forum first
- Please avoid the "C" prefix for your classes. This letter is reserved for framework classes.
- You can highlight code examples in this forum. Just select the text and click the <> icon in the editor or enclose it in [ code] ... [ /code] (without spaces in brackets)
Share this topic:
Page 1 of 1