fix(database): prevent deeply nested has many map adding extra empty object#1995
Conversation
Benchmark ResultsComparison of Open to see the benchmark results
Generated by phpbench against commit 7c8dee2 |
|
Ping me when ready for review :) |
|
Yes please, ready for review @brendt |
|
I wonder if we might have missed a test for this piece of code originally, because I'm kind of skeptical about removing it and everything just… continuing to work. Or, it could also be a leftover from an old iteration. I honestly don't remember. So I'm going to merge this, and we'll see if something goes wrong :) |
|
Yeah, I don't get what that piece of code could have originally been for. My reasoning is doesn't the later $data->set recursively add any needed unset parents when adding a new child? Which would make it unnecessary to preemptively add the empty parent. If it's any comfort I've been running a composer-patch of this change for a few weeks and haven't seen any issues, though I'm probably not covering anywhere near all use-cases. Fingers crossed! Thanks for merging! :) |
|
I had Claude take a look at it for 10 minutes because I genuinely didn't know anymore. I now think it was added to deal with setting an empty array for the first iteration so that the array itself was present. However, we're now using At least, that's my understanding for now. We'll see how it goes :) |
closes #1994
SelectModelMapperthat adds initial empty model. It doesn't seem necessary since the later$data->setadds the full nested path anyway. Please correct me if I'm wrong or if I broke anything. Tests are all still passing (including the failing one I added).