mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-03 14:02:47 +08:00
支持聚合更新
This commit is contained in:
@@ -735,8 +735,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
// 自动关联写入
|
||||
if (!empty($this->relationWrite)) {
|
||||
$relation = [];
|
||||
foreach ($this->relationWrite as $name) {
|
||||
if (isset($this->data[$name])) {
|
||||
foreach ($this->relationWrite as $key => $name) {
|
||||
if (!is_numeric($key)) {
|
||||
$relation[$key] = [];
|
||||
foreach ($name as $val) {
|
||||
if (isset($this->data[$val])) {
|
||||
$relation[$key][$val] = $this->data[$val];
|
||||
unset($this->data[$val]);
|
||||
}
|
||||
}
|
||||
} elseif (isset($this->data[$name])) {
|
||||
$relation[$name] = $this->data[$name];
|
||||
if (!$this->isUpdate) {
|
||||
unset($this->data[$name]);
|
||||
|
||||
Reference in New Issue
Block a user