DB batchInsert doesn't support JSON (array) fields#20684
DB batchInsert doesn't support JSON (array) fields#20684uaoleg wants to merge 1 commit intoyiisoft:masterfrom
Conversation
uaoleg
commented
Nov 19, 2025
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
| Fixed issues | 20683 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20684 +/- ##
============================================
- Coverage 78.15% 78.15% -0.01%
- Complexity 11565 11566 +1
============================================
Files 376 376
Lines 30727 30729 +2
============================================
+ Hits 24016 24017 +1
- Misses 6711 6712 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for the PR. The static analysis (PHPStan) needs to be corrected and a test added. What happens with DBMS that don't support JSON columns? I think this should be moved to the DBMS that do support that column type. Thks, |
|
@terabytesoftw currently it fails regardles DBMS |
| } | ||
| if (is_string($value)) { | ||
| if (is_array($value)) { | ||
| $value = json_encode($value); |
There was a problem hiding this comment.
This doesn't seem right. dbTypecast() should return JsonExpression for backends that supports JSON columns, and it should be handed by elseif ($value instanceof ExpressionInterface) branch bellow.
Could you provide a unit test for this case?