Tabular Input Problem

Hell i have a problem with collecting my Tabular Input i use this code in my collector:



$subfirms = new subfirms();


$subfirm = new subfirm();





$subfirms->attributes = $_POST['subfirms'];





foreach($subfirms as $i=>$subfirm)


{


    $subfirm->attributes=$_POST['subfirms'][$i];


    $subfirm->validate();


    $subfirm->save();


}


i have defined both subfirms and subfirm as class models but still when i try this i get the error 'Attempt to assign property of non-object' on - $subfirm->attributes=$_POST['subfirms'][$i]

Thanks for your help!

Your foreach is incorrect because $subfirms is an object, not an array as you declared here.

Oh ok thanks about that, but still i am having problems with the function getItemsToUpdate(), mainly as what should it return as a value, i am following this tutorial:

http://www.yiiframew…uide/form.table

It should return an array of model objects.