此代码引发异常:
public function actionSetdubl() {
$dubls = Yii::$app->request->post('dubl');
$parent = Yii::$app->request->post('parent');
$parentInfo = JurForm::find()->where(['PKJUR' => $parent])->asArray()->all()[0];
for ($i = 0; $i < sizeof($dubls); ++$i) {
$val = $dubls[$i];
$jur = JurForm::findOne($val);
$jur->CFLDUBL = 'Yes';
$jur->DUBLMDM_ID = $parentInfo['MDM_ID'];
$jur->DCHANGEDATE = date('Y-m-d H:i:s');
$jur->save();
}
return Yii::$app->getResponse()->redirect('/index.php?r=jur/analysis');
}
在代码
$jur = JurForm::findOne($val);
的行上。例外情况:
Setting unknown property: app\models\JurForm::PKJUR.
数据库:Oracle。
最佳答案
也许更好?
$parentInfo = JurForm::find()->where(['PKJUR' => $parent])->asArray()->one()
另外,我认为pkjur没有在db中定义。