TII framework and serialize()

Hello,

I have a table:


CREATE TABLE IF NOT EXISTS `legal` (

  `legalId` int(64) NOT NULL AUTO_INCREMENT,

  `legalName` varchar(512) NOT NULL,

  `legalCollection` text NOT NULL,

  PRIMARY KEY (`legalId`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

and as you will probably have guessed, legalCollection should contain a serialized array. Now my question is how can i retrieve it using Yii in the most simplest form?

I can’t use CActiveDataProvider because i don’t think it converts my serialized array to an actual php array or does it?

Thanks,

Tim

Why can’t you use PHP implode() & explode() functions?

You can override afterFind method in the active record class:




class Legal extends CActiveRecord

{


   public function afterFind()

   {


      $this->legalCollection = !empty($this->legalCollection) ? unserialize($legalCollection) : array();


      parent::afterFind();


   }


}