yii-joblo / multimodelform

Yii extension multimodelform
13 stars 9 forks source link

Now the widget handles correctly the composite primary keys when rendering the elements. #10

Closed maurobender closed 10 years ago

maurobender commented 10 years ago

Related to the issue: https://github.com/yii-joblo/multimodelform/issues/9.

yii-joblo commented 10 years ago

I was testing your code and had issues with numerical pk=0. So I will change to

 $elem_pk = $this->primaryKey;
                $valid_elem_pk = !empty($elem_pk);
                if($valid_elem_pk && is_array($elem_pk))
                {
                    $valid_elem_pk = true;
                    foreach($elem_pk as  $t_pk)
                    {
                        //allow numerical 0, boolean false as valid pk
                        $valid_elem_pk = $valid_elem_pk && $t_pk!=='' && !is_null($t_pk);
                    }
                }

Does this work for you?