saya ingin bertanya tentang ztabularinput…
untuk actioncreate saya sudah sukses,tetapi belum sukses untuk actionUpdate
public function actionUpdate($id)
{
$model=$this->loadModel($id);
$studentManager = StudentManager::load($model);
//$studentManager=new studentManager();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['ClassRoom']))
{
$model->attributes=$_POST['ClassRoom'];
$studentManager->manage($_POST['Student']);
if (!isset($_POST['noValidate']))
{
$valid=$model->validate();
$valid=$studentManager->validate($model) && $valid;
if($valid)
{
$model->save();
$studentManager->save($model);
$this->redirect(array('view','id'=>$model->id));
}
}
}
$this->render('create',array(
'model'=>$model,
'studentManager'=>$studentManager,
));
}
saya mendapat error dari kode load:
public static function load($model)
{
$return= new StudentManager;
[b] foreach ($model->students as $item)//apa isi dari model->students?[/b]
$return->_items[$item->primaryKey]=$item;
return $return;
}
database yang saya buat hanya:
class Room
-id
-name
student
-id
-name
-surname
-class_id
mohon bantuanya,