parent
c7841f87f8
commit
3f02c0547e
@ -2023,8 +2023,9 @@ class PatientOrderService extends BaseService
|
||||
'user_name' => $UserDoctor['user_name'] ?? null,
|
||||
'doctor_title' => $UserDoctor['doctor_title'] ?? null,
|
||||
]);
|
||||
// 使用 setRelation 方法确保关联对象正确设置
|
||||
// 同时使用 setRelation 和数组赋值,确保无论是通过关系访问还是数组访问都能获取到新对象
|
||||
$item->setRelation('UserDoctor', $UserDoctor);
|
||||
$item['UserDoctor'] = $UserDoctor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2035,8 +2036,9 @@ class PatientOrderService extends BaseService
|
||||
if (is_object($userDoctor)) {
|
||||
// 使用对象属性语法修改
|
||||
$userDoctor->doctor_title = DoctorTitleCode::getMessage($userDoctor->doctor_title);
|
||||
// 确保修改后的对象重新设置到关系中
|
||||
// 确保修改后的对象同时设置到关系和数组中
|
||||
$item->setRelation('UserDoctor', $userDoctor);
|
||||
$item['UserDoctor'] = $userDoctor;
|
||||
} else {
|
||||
// 如果是数组,直接修改数组
|
||||
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user