Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SoftDeleteable] Fix filter not invalidating Query cache #2112

Merged

Conversation

alanpoulain
Copy link
Contributor

When the query cache is enabled for the ORM entity manager, enabling or disabling the soft deleteable filter for an entity doesn't change the hash of the filter. Therefore, the result cannot change.

The only way to invalidate the query cache is to set a varying (depending of the entity enabled or disabled) boolean parameter (the hash of a filter is calculated by serializing the parameters: https://github.com/doctrine/orm/blob/8c259ea5cb632dbb57001b2262048ae7fa52b102/lib/Doctrine/ORM/Query/Filter/SQLFilter.php#L110-L113).

The first commit is a failing test to show the issue, the second one fixes it.

@AkenRoberts AkenRoberts merged commit a7a2eba into doctrine-extensions:v2.4.x Apr 28, 2020
@AkenRoberts
Copy link
Member

Great work, Alan. Thank you very much. 👏

AkenRoberts added a commit that referenced this pull request Apr 28, 2020
@AkenRoberts
Copy link
Member

Tagged v2.4.40

AkenRoberts pushed a commit that referenced this pull request Apr 28, 2020
* Add a failing test

* Invalide the query cache when toggling the filter for an entity
# Conflicts:
#	tests/Gedmo/SoftDeleteable/SoftDeleteableEntityTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants