Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复关联对象动态设置表后缀之后写入数据时不自动添加数据表后缀的问题 #498

Open
wants to merge 2 commits into
base: 2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/model/relation/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function make($data = []): Model
// 保存关联表数据
$data[$this->foreignKey] = $this->parent->{$this->localKey};

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/MorphMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function make($data = []): Model
$data[$this->morphKey] = $this->parent->$pk;
$data[$this->morphType] = $this->type;

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/MorphOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function make($data = []): Model
$data[$this->morphKey] = $this->parent->$pk;
$data[$this->morphType] = $this->type;

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/relation/OneToOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function make($data = []): Model
// 保存关联表数据
$data[$this->foreignKey] = $this->parent->{$this->localKey};

return new $this->model($data);
return (new $this->model($data))->setSuffix($this->getModel()->getSuffix());
}

/**
Expand Down