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