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

11783 failure with indexed relation #11792

Merged

Conversation

dbannik
Copy link
Contributor

@dbannik dbannik commented Jan 17, 2025

Fix issue #11783

src/Cache/CollectionCacheKey.php Outdated Show resolved Hide resolved
src/Cache/DefaultCache.php Outdated Show resolved Hide resolved
@greg0ire
Copy link
Member

Also, please squash the commits together (since you wouldn't revert one without the others, right?), and improve the remaining commit message according to the contributing guide. Specifically, explain both the bug and the fix.

@dbannik dbannik force-pushed the 11783-failure-with-indexed-relation branch from b0766d6 to 43d33aa Compare January 17, 2025 09:09
@dbannik
Copy link
Contributor Author

dbannik commented Jan 17, 2025

Also, please squash the commits together (since you wouldn't revert one without the others, right?), and improve the remaining commit message according to the contributing guide. Specifically, explain both the bug and the fix.

done

@dbannik
Copy link
Contributor Author

dbannik commented Jan 17, 2025

@greg0ire The problem with phpstan checking still exists, it should be fixed in a separate commit

@greg0ire
Copy link
Member

See #11793

@dbannik dbannik force-pushed the 11783-failure-with-indexed-relation branch from 43d33aa to 47a3015 Compare January 19, 2025 19:14
@dbannik
Copy link
Contributor Author

dbannik commented Jan 19, 2025

See #11793

Rebased PR

@dbannik dbannik requested a review from greg0ire January 19, 2025 19:29
@greg0ire greg0ire added the Bug label Jan 20, 2025
@greg0ire
Copy link
Member

The bug related (#11694) and fixed mapping of sql column alias to field in entity (#11783) and
invalidate cache [cache/persisted/entity|cache/persisted/collection] when sql filter changes

if you are doing 2 things in one commit, that's bad. You should be doing 2 commits with clear messages, so that if one of them is wrong, it can be understood and reverted while the other stays.

@dbannik dbannik force-pushed the 11783-failure-with-indexed-relation branch from 47a3015 to 2b62d35 Compare January 21, 2025 14:03
@dbannik
Copy link
Contributor Author

dbannik commented Jan 21, 2025

The bug related (#11694) and fixed mapping of sql column alias to field in entity (#11783) and
invalidate cache [cache/persisted/entity|cache/persisted/collection] when sql filter changes

if you are doing 2 things in one commit, that's bad. You should be doing 2 commits with clear messages, so that if one of them is wrong, it can be understood and reverted while the other stays.

these 2 things can't be separated
since separately the tests will fail

greg0ire
greg0ire previously approved these changes Jan 21, 2025
@@ -611,12 +616,13 @@ public function refresh(array $id, $entity, $lockMode = null)
*
* @return CollectionCacheKey
*/
protected function buildCollectionCacheKey(array $association, $ownerId)
protected function buildCollectionCacheKey(array $association, $ownerId, string $filterHash)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greg0ire Is introducing a new argument to a protected method okay in a version-branch that's already released? It may break projects that are implementing the Abstract class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't spot that one. You're right, it's a breaking change for extending classes, that suddenly need to have that extra argument, and for callers, that need to provide it.

@dbannik please resort to func_get_args(). The new argument should be added in the next major release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greg0ire instead of func_get_args can we use default value ?

Suggested change
protected function buildCollectionCacheKey(array $association, $ownerId, string $filterHash)
protected function buildCollectionCacheKey(array $association, $ownerId, string $filterHash = '')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would still be a breaking change for extending classes (they would suddenly have incompatible signatures).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

The bug related (doctrine#11694) and fixed mapping of sql column alias to field in entity (doctrine#11783) and
invalidate cache [cache/persisted/entity|cache/persisted/collection] when sql filter changes
@dbannik dbannik force-pushed the 11783-failure-with-indexed-relation branch from 2b62d35 to 6755bb0 Compare January 27, 2025 12:36
@greg0ire greg0ire added this to the 2.20.2 milestone Jan 28, 2025
@greg0ire greg0ire merged commit 9e999ea into doctrine:2.20.x Jan 28, 2025
74 checks passed
@greg0ire
Copy link
Member

Thanks @dbannik !

@dbannik dbannik deleted the 11783-failure-with-indexed-relation branch January 31, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants