[PR #5899] respect indexBy when using second level cache #9780

Open
opened 2026-01-22 16:05:23 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/5899

State: closed
Merged: No


Hello,

this fixes issue #5889.

As this is my first contribution to doctrine, please review thoroughly. Any feedback is very welcome.

Things to consider:

  • Should i rename the functional test from DDC5889 to GH5889?
  • I would prefer to already write the correct index to the cache (because written to the cache may occur less often then reading from it). However, there is code which expects the index from the cache keys to be the same as the index from the initial collection. Thats why "reindex" occurs on reading from the cache now. As a small positive side effect: this means the caching adapter does not have to support indexes. Also no need for cache purging for metadata changes when indexing occurs on the read-side.
  • If you agree that the implementation is okay so far, i might add a unit test for the DefaultCollectionHydrator class if you want.
**Original Pull Request:** https://github.com/doctrine/orm/pull/5899 **State:** closed **Merged:** No --- Hello, this fixes issue #5889. As this is my first contribution to doctrine, please review thoroughly. Any feedback is very welcome. Things to consider: - Should i rename the functional test from DDC5889 to GH5889? - I would prefer to already write the correct index to the cache (because written to the cache may occur less often then reading from it). However, there is [code which expects the index from the cache keys to be the same as the index from the initial collection](https://github.com/BreiteSeite/doctrine2/blob/ff4e02f202a6977492ed530b435fb28e828d3d8b/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php#L193). Thats why "reindex" occurs on reading from the cache now. As a small positive side effect: this means the caching adapter does not have to support indexes. Also no need for cache purging for metadata changes when indexing occurs on the read-side. - If you agree that the implementation is okay so far, i might add a unit test for the DefaultCollectionHydrator class if you want.
admin added the pull-request label 2026-01-22 16:05:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9780