在测试 CRUD 生成的创建表单时,我收到以下错误。有谁熟悉这个问题?提前谢谢。
未定义索引:contactindivs
07 $this->render('view', array(
08 'model' => $this->loadModel($id, 'Companylocation'),
09 ));
10 }
11
12 public function actionCreate() {
13 $model = new Companylocation;
14
15
16 if (isset($_POST['Companylocation'])) {
17 $model->setAttributes($_POST['Companylocation']);
18 $relatedData = array(
19 'contactindivs' => $_POST['Companylocation']['contactindivs'] === '' ? null : $_POST['Companylocation']['contactindivs'],
20 );
21
22 if ($model->saveWithRelated($relatedData)) {
23 if (Yii::app()->getRequest()->getIsAjaxRequest())
24 Yii::app()->end();
25 else
26 $this->redirect(array('view', 'id' => $model->CompanyLocationID));
27 }
28 }
29
30 $this->render('create', array( 'model' => $model));
31 }