Membuat 1 Input form untuk 2 table

Masta masta minta bantuannya saya mau membuat 1 form yang nantinya akan digunakan untuk 2 table caranya bagai mana ?

Controller:




public function actionSomeAction()

{

  $model1=new Model1; // tabel 1

  $model2=new Model2; // tabel 2

  if(isset($_POST['Model1'],$_POST['Model2']))

  {

    $model1->attributes=$_POST['Model1'];

    $model2->attributes=$_POST['Model2'];

    

    if($model1->save() && $model2->save())

      $this->redirect(array('module/controller/action'));

  }

	$this->render('form',array('model1'=>$model1,'model2'=>$model2));

}



View:




<?php echo $form->errorSummary($model1); ?>

<?php echo $form->errorSummary($model2); ?>


<div class="row">

  <?php echo $form->labelEx($model1,'fieldA'); ?>

  <?php echo $form->textField($model1,'fieldA',array('size'=>60,'maxlength'=>255)); ?>

</div>


<div class="row">

  <?php echo $form->labelEx($model2,'fieldB'); ?>

  <?php echo $form->textField($model2,'fieldB',array('size'=>60,'maxlength'=>255)); ?>

</div>



Versi cepat, mohon koreksi :)

mungkin ini ada hubujngannya

http://www.yiiframework.com/forum/index.php?/topic/11997-input-form-beda-model/

ane coba dulu braw