Repository navigation
fix(documents): keep the collection as the last key of found rows - #1101
Conversation
Setting $collection before decode() moved it ahead of relationship keys, which decode() re-appends, so find() and the documents it populates changed key order. Re-append it after decoding so the output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code review
The change re-appends Walkthrough (2)
Reviewed Tip Comment |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|

What
Follow-up to #1099. After
find()decodes a row,$collectionis re-appended so it stays the last key of each returned document, wherefind()has always returned it.Why
#1099 set the collection on found rows before decoding them, which fixed filters that depend on it but moved
$collectionto a different position in the returned document. Consumers that compare the key order offind()output (for example recorded compatibility expectations) saw a behaviour change. These two commits were pushed to the branch after #1099 merged, so no release contains them yet and downstream projects have had to depend on the branch directly.Changes
src/Database/Trait/Documents.php: re-append$collectionafter decoding a non-empty found row.tests/unit/FilterCollectionTest.php: asserts$collectionis the last key of a found row; narrows the populated owner before reading its id.Testing
Covered by the unit test above; CI runs the full suites.
🤖 Generated with Claude Code
Summary by CodeRabbit