I solved my problem

I had to use return unserialize( parent::_get('status') );

because base class uses magic method to return value and caused
infinite loop by method calling itself or something like that ;)

On Feb 17, 3:53 pm, wickass <wick...@gmail.com> wrote:
> I am using symfony 1.4 in a project and i need to store multiple
> options in a single field .
>
> I am using sfWidgetFormChoice Set up loooks like this:
>
> $status = Doctrine::getTable('Profile')->getStatuses();
>         $this->widgetSchema['status'] = new sfWidgetFormChoice(array(
>             'expanded'=>true,
>             'choices'=>$status,
>             'multiple'=>true
>             ));
>         $this->validatorSchema['status'] = new
> sfValidatorChoice(array('choices'=>array_keys($status),
> 'multiple'=>true, 'required'=>false));
>
> In my model I use the following to serialise multiple options into
> single field.
>
>  public function  setStatus($data) {
>         $data = serialize($data);
>
>         $this->_set('status', $data);
>
>     }
>
> Which works like a charm and save data as:
>
> a:2:{i:0;s:7:"relaxed";i:1;s:8:"Inactive";}
>
> However I'm am having difficulty retrieving the serialised string as
> an array using the following in my model:
>
> public function  getStatus() {
>         return unserialize($this->status);
>     }
>
> Am I missing something here? I get the following error:
>
> Notice: Undefined property: Profile::$status in C:\.../.././
> Which doesnt make sense to me..

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to