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

为create和update的data添加object类型 #638

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Conversation

1421393078
Copy link

如题

@big-dream
Copy link
Contributor

数组跟对象有很大区别吧,不知道这改动的用意是?

@1421393078
Copy link
Author

数组跟对象有很大区别吧,不知道这改动的用意是?

在最后面 $model->replace($replace)->save($data); 的 save 方法也是可以传入对象的。我主要是用于直接使用 DTO 保存到数据库.
$data = new DTO();
$model = new Model();
$model->save($data);
现在是 save 支持这样写的

但是静态方法的 create 的 $data 参数只有 array, 估计是忘了
Model::create($data);

@1421393078
Copy link
Author

数组跟对象有很大区别吧,不知道这改动的用意是?

$model->replace($replace)->save($data);
在 \think\model::create 方法, 文件中的第 959 行

Copy link

codecov bot commented Sep 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 22.23%. Comparing base (14b8bde) to head (6d859b8).
Report is 1 commits behind head on 3.0.

Files with missing lines Patch % Lines
src/Model.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##                3.0     #638   +/-   ##
=========================================
  Coverage     22.23%   22.23%           
  Complexity     3076     3076           
=========================================
  Files            65       65           
  Lines          7332     7332           
=========================================
  Hits           1630     1630           
  Misses         5702     5702           
Flag Coverage Δ
unittests 22.23% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@liu21st liu21st merged commit b9f1620 into top-think:3.0 Sep 18, 2024
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants