mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #5812] Use ResultSetMapper in cache key so schema changes invalidate cache #9737
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/5812
State: closed
Merged: No
This fixes a long standing issue we've been facing with schema changes and result caching.
When new code is deployed that contains a scheme change any queries hitting the result cache return null values because of this check. Adding or removing any fields make the keys defined by the ResultSetMapper different then the keys stored in the cache. As a result the ObjectHydrator can't find the id so it return null for each which makes for some confusing errors.
This change adds a hash of the current ResultSetMapper to the real key effectively invalidating the cache on any schema changes for any entity in the query.
REQUIRES:
https://github.com/doctrine/dbal/pull/2383