adding manual data for attributes model manualy

hello guys . im soory im asking again …

i had this trouble since this morning …

i want to save an array into a model that i get from multiple field


                    //print_r($_POST['komponent']);    [i]//  [0] => a [1] => b [/i]

                    $mod = array("komponent" => $_POST['komponent']);

                    print_r($mod);   [i]//Array ( [komponent] => Array ( [0] => a [1] => b ) ) [/i]

                    $modelb->attributes= $mod;



i tried to input this with an array into field named komponent

i had tried to save with more declare in model like this

$modelb->attributes['komponent'] = $mod;

when i see in database my field fulled with "array" not the data i tried to store …

oh yea . i had tried this one too …

i thougt when looping it will store manualy one by one



                    foreach ($_POST['komponent'] as $newkomponent):


                        $baru = array('komponent'=>$newkomponent);


                        $modelb->attributes = $baru;







need you`r help :)

Take a look

public function setAttributes($values,$safeOnly=true)




		$attributes=array_flip($safeOnly ? $this->getSafeAttributeNames() : $this->attributeNames());

		foreach($values as $name=>$value)




			else if($safeOnly)




framework checks if the model has such attribute


then it sets the value


then have a look your output

[i]//Array ( [komponent] => Array ( [0] => a [1] => b ) ) [/i]

framework tries to find 0 and 1 attributes from model

then it can not find then does not set value to model.

instead of 0 and 1 here should be attr names.

thanks for your help . i will try to implement this code :)