mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
关联模型D函数替代
This commit is contained in:
@@ -148,7 +148,7 @@ trait Relation
|
|||||||
$mappingFk = !empty($val['foreign_key']) ? $val['foreign_key'] : strtolower($this->name) . '_id'; // 关联外键
|
$mappingFk = !empty($val['foreign_key']) ? $val['foreign_key'] : strtolower($this->name) . '_id'; // 关联外键
|
||||||
}
|
}
|
||||||
// 获取关联模型对象
|
// 获取关联模型对象
|
||||||
$model = D($mappingClass);
|
$model = \think\Loader::model($mappingClass);
|
||||||
switch ($mappingType) {
|
switch ($mappingType) {
|
||||||
case HAS_ONE:
|
case HAS_ONE:
|
||||||
$pk = $result[$mappingKey];
|
$pk = $result[$mappingKey];
|
||||||
@@ -262,7 +262,7 @@ trait Relation
|
|||||||
$mappingCondition[$mappingFk] = $pk;
|
$mappingCondition[$mappingFk] = $pk;
|
||||||
}
|
}
|
||||||
// 获取关联model对象
|
// 获取关联model对象
|
||||||
$model = D($mappingClass);
|
$model = \think\Loader::model($mappingClass);
|
||||||
$mappingData = isset($data[$mappingName]) ? $data[$mappingName] : false;
|
$mappingData = isset($data[$mappingName]) ? $data[$mappingName] : false;
|
||||||
if (!empty($mappingData) || 'DEL' == $opType) {
|
if (!empty($mappingData) || 'DEL' == $opType) {
|
||||||
switch ($mappingType) {
|
switch ($mappingType) {
|
||||||
@@ -389,7 +389,7 @@ trait Relation
|
|||||||
continue; // 自引用关联或提交关联数据跳过
|
continue; // 自引用关联或提交关联数据跳过
|
||||||
}
|
}
|
||||||
// 获取关联model对象
|
// 获取关联model对象
|
||||||
$model = D($mappingClass);
|
$model = \think\Loader::model($mappingClass);
|
||||||
$_data = $data[$mappingName];
|
$_data = $data[$mappingName];
|
||||||
unset($data[$key]);
|
unset($data[$key]);
|
||||||
if ($_data = $model->token(false)->create($_data)) {
|
if ($_data = $model->token(false)->create($_data)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user