Trying to use the ztabularinputmanager following the instructions here:
http://www.yiiframework.com/extension/ztabularinputmanager#add-comment
the actionCreate method of my mode is as below:
public function actionCreate()
{
$model=new Event;
$mediaManager = new eventMediaManager();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Event']))
{
$model->attributes=$_POST['Event'];
$mediaManager->manage($_POST['EventMedia']);
if (!isset($_POST['noValidate'])){
$valid = $model->validate();
$valid = $mediaManager->validate($model) && $valid;
}
if($valid){
$model->save();
$mediaManager->save($model);
$this->redirect(array('view','id'=>$model->id));
}
}
$this->render('create',array(
'model'=>$model,
'mediaManager'=>$mediaManager,
));
}
but when I run the create action, the _form.php would load with an error saying Undefined variable: mediaManager whenever I used $mediaManager. Does anyone know why?
I used xDebug and verified that $mediaManager exists during the actionCreate, but it seems to disappeared in _form.php. I thought I passed it in. Did I do something wrong?