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

Document ORM drivers only really load ORM metadata #9677

Merged
merged 1 commit into from
Apr 24, 2022

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Apr 24, 2022

Note: I'm not sure I made a great choice in doctrine/persistence#180 when I used templating in MappingDriver to bind $className to $metadata, as double templating does not seem possible, meaning we can't use it to get rid of the docblocks I added:

Although this is clearly not a bugfix and touches src, I'm targeting 2.12.x because assert is not supposed to affect production, and touching baseline files is best done on the lowest-supported branch IMO, so that there are not too many conflicts.

@greg0ire greg0ire force-pushed the assert-drivers-are-orm-specific branch 5 times, most recently from d862703 to ebfa2f5 Compare April 24, 2022 17:41
@greg0ire greg0ire changed the title Assert ORM drivers load ORM metadata Document ORM drivers load ORM metadata Apr 24, 2022
@greg0ire greg0ire changed the title Document ORM drivers load ORM metadata Document ORM drivers only really load ORM metadata Apr 24, 2022
@greg0ire greg0ire force-pushed the assert-drivers-are-orm-specific branch from ebfa2f5 to c23b598 Compare April 24, 2022 17:44
@greg0ire greg0ire requested a review from derrabus April 24, 2022 17:54
@@ -31,7 +31,7 @@ protected function convertToClassMetadata(array $entityTables, array $manyTables

$metadatas = [];
foreach ($driver->getAllClassNames() as $className) {
$class = new ClassMetadataInfo($className);
$class = new ClassMetadata($className);
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 first implemented this with assert, then was forced to changed this test, which made me think this was a bit risky, hence the change towards phpdoc. It's better anyway, since it makes static analysis able to detect calls to these methods made with ClassMetadataInfo rather than ClassMetadata.

@greg0ire greg0ire requested a review from SenseException April 24, 2022 17:56
@greg0ire greg0ire force-pushed the assert-drivers-are-orm-specific branch from c23b598 to 85238d4 Compare April 24, 2022 18:11
@greg0ire greg0ire requested a review from derrabus April 24, 2022 18:23
@derrabus
Copy link
Member

assert is not supposed to affect production

You're only removing assert() calls and not adding new ones. I think targeting 2.12.x is fine.

@greg0ire
Copy link
Member Author

You're only removing assert() calls and not adding new ones. I think targeting 2.12.x is fine.

Sorry, when I wrote this I had added some calls to assert, then switched to phpdoc and forgot to edit that part out.

@greg0ire greg0ire added this to the 2.12.2 milestone Apr 24, 2022
@greg0ire greg0ire merged commit a552df6 into doctrine:2.12.x Apr 24, 2022
@greg0ire greg0ire deleted the assert-drivers-are-orm-specific branch April 24, 2022 18:55
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