-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[DDC-3346] Failing test for issue (bad findOneBy behaviour with eager fetch) #1277
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3531 We use Jira to track the state of pull requests and the versions they got |
public function testFindOneByWithEagerFetch() | ||
{ | ||
$user = new DDC3346Author(); | ||
$user->name = "Buggy Woogy"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove these fields?
Wondering about the resolution path for this: my opinion is that we should just disable the eager loading when a |
@Ocramius I've updated test. Does it looks right? Generally, I see three options:
|
This is what I'll try doing. The additional queries are a side-effect that cannot be avoided.
Not really possible, as you'll just hit the identity map in this case. I'll look into it though.
This involves going through the paginator API (2 queries), and we really don't want to do that given the horrible amount of paginator-related issues with mssql and other exotic DBMS. |
I took a look through the sources, and the problem really occurs with any limit set. I've updated the test to respect this. |
Also I realized that offset parameter in I think that disabling eager loading is dirty workaround, because it would have unattended performance impact. Second way is something intermediate. |
Doing the opposite is actually worse, as the state of the loaded entities will be corrupted, and all event listeners will be broken instead. Patching state by refreshing entities is not a good idea. If the user configures eager loads, it's his own fault there: a second query is an acceptable tradeoff. |
I have a fix for this, but it's not complete yet. Fix will be applied in 2.5: 2.4.x will probably get an exception message instead (for now). |
…ly created `CachedPersisterContext`
…e newly created `CachedPersisterContext`
…y created `CachedPersisterContext`
…wly created `CachedPersisterContext`
…wly created `CachedPersisterContext`
…ime, depending on choices
…en limiting and fetch-joining to-many eager associations
…ET repository API (must not hydrate collections)
…Up/tearDown of model-related tables)
…sting more than 1 row
This bug does not affect 2.4.x, as the eager loading does not work with |
…ly created `CachedPersisterContext`
…e newly created `CachedPersisterContext`
…y created `CachedPersisterContext`
…wly created `CachedPersisterContext`
…wly created `CachedPersisterContext`
…ime, depending on choices
…en limiting and fetch-joining to-many eager associations
…ET repository API (must not hydrate collections)
…Up/tearDown of model-related tables)
…sting more than 1 row
…ling (better to just use private props)
…er-loads-is-failing [DDC-3346] #1277 find one with eager loads is failing
Here is the test for DDC-3346 issue