Skip to content

Conversation

yann-eugone
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (bb81f79) 99.67% compared to head (3c3f912) 99.68%.

Additional details and impacted files
@@            Coverage Diff            @@
##                0.x      #70   +/-   ##
=========================================
  Coverage     99.67%   99.68%           
- Complexity      794      801    +7     
=========================================
  Files           134      135    +1     
  Lines          2172     2196   +24     
=========================================
+ Hits           2165     2189   +24     
  Misses            7        7           
Impacted Files Coverage Δ
.../batch-doctrine-persistence/src/ObjectRegistry.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@yann-eugone yann-eugone changed the title Introduce a doctrine ObjectRegistry that caches found objects during jobs Add doctrine ObjectRegistry that remember object identities Jun 12, 2023
Copy link
Contributor

@halundraN halundraN left a comment

Choose a reason for hiding this comment

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

Ok in principle.
But warning, this kind of feature has already caused me some problems.
Especially in the case of an entityManager#clear which does not clear the repository object.
All object in the ObjectRepository would be considere as new.

@yann-eugone
Copy link
Contributor Author

But here, the registry never remember objects, only identities.
If you call ObjectManager::clear during a job of yours, all objects will be detached, and when you will call the ObjectRegistry::*, instead of running a multi-criteria query, the object will be found using it's identity: more efficient query (and if object is already hydrated, no query at all)

@yann-eugone yann-eugone merged commit f7fbeaf into 0.x Jul 10, 2023
@yann-eugone yann-eugone deleted the doctrine-persistence-object-registry branch January 29, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants