类注册的对象无法转换为int

时间:2015-11-18 07:30:25

标签: yii

$model_reg_b = BusinessNatureMappingForm::model()->findbyPk($model_reg);
foreach ($model_reg_b->BusinessNatureMappingForm as $keyi1 => $model_reg_bb) {
    $model_ownerm = OwnershipSpecificDetailsForm::model()->findByAttributes(array("bnsd_bnmid" => $model_reg_bb->bnm_regid));
}

1 个答案:

答案 0 :(得分:0)

我认为您使用模型作为findbyPk()的参数而不是主键属性(例如$model_reg->id)。

改变这个:

$model_reg_b = BusinessNatureMappingForm::model()->findbyPk($model_reg);

对此:

$model_reg_b = BusinessNatureMappingForm::model()->findbyPk($model_reg->primary_key_column);