hi there !
[b]there is so many topics about serialized data in yii framework but …
I Have Decided to migration my old project to yii but I have simple problem with some database columns
some of that had stored with serialized data and want to view,update,insert this data but I cant do in with unserialize functions !
how can I do in with Yii , ?
how can I change default model insert that generated by Gii , … ?
so many thanks in advance for anyone else who can help me.
my old database had a column that saved attache files in an array and serilez data and insert that to mysql and I want now to usnerlize that array in yii framework
You can do this:
create model’s public property, for example
public $unserialized = array();
then use afterFind to fill it:
public function afterFind()
$this->unserialized = some_function($this->serialized); // unserialize
and beforeSave to store it:
public function beforeSave()
$this->serialized = some_function2($this->unserialized) = ....; // serialize
So you will be able to use this property in your code, for example:
$record = MyModel::model()->findByPk(1);
thanks you so much,
I’m going to do this . this is a logical solution .