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

Resort on Query::HINT_FORCE_PARTIAL_LOAD less #10798

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

greg0ire
Copy link
Member

A lot of our tests mention it, but I do not think it is important to the test. Maybe it was a way to have more efficient tests? Most times, removing the hint does not affect the test outcome.

@SenseException
Copy link
Member

The tests didn't seem to check the other sides of the partial objects. Were those all created for the partial objects?

@greg0ire
Copy link
Member Author

Sorry, what do you mean by "other sides"?

@SenseException
Copy link
Member

Most times, removing the hint does not affect the test outcome.

They check the properties that are part of the partial, but not the ones left out of the query, that aren't hydrated. Or at least that's what I assume considering the DQL in the comments. So there couldn't be much of a different outcome after the partial-parts were removed.

@greg0ire
Copy link
Member Author

The tests didn't seem to check the other sides of the partial objects. Were those all created for the partial objects?

I do not think the tests were created for testing partial objects, but for testing hydration, because "partial" is not mentioned in the title of these tests. Partial objects might have been used as a way to speed up the tests.

A lot of our tests mention it, but I do not think it is important to the
test. Maybe it was a way to have more efficient tests? Most times,
removing the hint does not affect the test outcome.
@greg0ire greg0ire force-pushed the less-partial-load branch from 2faa11c to 4da8d3b Compare June 27, 2023 06:37
@beberlei
Copy link
Member

The tests seem to be for partial loading wirh the hydrator, dont they throw an exception in 3.0 for missing properties?

@greg0ire greg0ire marked this pull request as draft June 27, 2023 10:16
@greg0ire
Copy link
Member Author

I will try removing support for partial objects on 3.0 and see what happens.

@greg0ire
Copy link
Member Author

🤔 whey I try accessing CmsUser::status in testSimpleEntity, I get an error about the fact that it is not initialized. And I get it only if I try performing that access. Am I supposed to get an exception before that?

@beberlei
Copy link
Member

@greg0ire i was under the impression that the hydrator or UoW::createEntity would just flat out refuse to hydrate the object and bail.

@greg0ire greg0ire marked this pull request as ready for review June 27, 2023 20:42
@greg0ire
Copy link
Member Author

It does not seem to care 🙂

@@ -200,7 +199,7 @@ public function testSimpleMultipleRootEntityQuery(): void
}

/**
* SELECT PARTIAL u.{id, name} AS user, PARTIAL a.{id, topic}
* SELECT u AS user, a
* FROM Doctrine\Tests\Models\CMS\CmsUser u, Doctrine\Tests\Models\CMS\CmsArticle a
*/
public function testSimpleMultipleRootEntityQueryWithAliasedUserEntity(): void
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think these tests are about partial objects. For instance, according to the title, this one seems to be about testing that the objecthydrator works when the rsm as several root entities, and one of them is aliased. I think they still make sense, even after removing partial objects.

Copy link
Member

Choose a reason for hiding this comment

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

Seems like the partial objects really were just unrelated to the tests.

@SenseException
Copy link
Member

I get an error about the fact that it is not initialized. And I get it only if I try performing that access.

Is this happening when you access a property that isn't part of the partial object hydration?

@greg0ire
Copy link
Member Author

Yes, and that's because I deliberately added that access to see what would happen.

@SenseException
Copy link
Member

Should this target 2.16.x now before merging? Seems like this can be approved from what we are knowing.

@greg0ire
Copy link
Member Author

I don't think so: it only touches the test suite. Having branches as similar as possible is best when there it does not come with a stability impact, IMO.

Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

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

Okay.

@greg0ire greg0ire added this to the 2.15.4 milestone Jul 11, 2023
@greg0ire greg0ire merged commit 385bdd3 into doctrine:2.15.x Jul 11, 2023
@greg0ire greg0ire deleted the less-partial-load branch July 11, 2023 21:46
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.

3 participants