top-think / think-orm

Think ORM——the PHP Database&ORM Framework
Apache License 2.0
413 stars 171 forks source link

一对一关联,绑定关联属性支持 Closure #616

Closed big-dream closed 2 weeks ago

big-dream commented 3 weeks ago

目前只能单纯绑定值,无法进行处理再返回,没这么灵活。

codecov[bot] commented 3 weeks ago

Codecov Report

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

Project coverage is 22.23%. Comparing base (f533985) to head (cfa6148). Report is 4 commits behind head on 3.0.

Files Patch % Lines
src/model/concern/RelationShip.php 88.88% 1 Missing :warning:
src/model/relation/OneToOne.php 88.88% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## 3.0 #616 +/- ## ============================================ + Coverage 17.42% 22.23% +4.81% - Complexity 3005 3008 +3 ============================================ Files 64 64 Lines 7209 7219 +10 ============================================ + Hits 1256 1605 +349 + Misses 5953 5614 -339 ``` | [Flag](https://app.codecov.io/gh/top-think/think-orm/pull/616/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=top-think) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/top-think/think-orm/pull/616/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=top-think) | `22.23% <88.88%> (+4.81%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=top-think#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

liu21st commented 3 weeks ago

不如直接改成 支持闭包 callable这种类型使用的时候很容易产生混淆

big-dream commented 3 weeks ago

不如直接改成 支持闭包 callable这种类型使用的时候很容易产生混淆

好的,我这边调调。主要考虑到 [A::class, 'method'] 这种形式,可以复用方法

liu21st commented 3 weeks ago

用法统一比较好一点 你这种闭包也能支持