改进聚合模型主键和关联键相同的情况

This commit is contained in:
thinkphp
2016-09-30 15:10:10 +08:00
parent c51416c7d4
commit 7f2880603c

View File

@@ -126,7 +126,7 @@ class Merge extends Model
$item = [];
foreach ($data as $key => $val) {
if ($insert || in_array($key, $this->change) || $this->isPk($key)) {
if (array_key_exists($key, $this->mapFields)) {
if ($this->fk != $key && array_key_exists($key, $this->mapFields)) {
list($name, $key) = explode('.', $this->mapFields[$key]);
if ($model == $name) {
$item[$key] = $val;