-
Notifications
You must be signed in to change notification settings - Fork 2.5k
favor Table::addPrimaryKeyConstraint() over Table::setPrimaryKey() #11882
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
Conversation
tests were already failing before on the |
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.
Thanks @xabbuh!
I'd be nice merging these PRs ASAP to help make the Symfony CI green again 🙏
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.
Why are the symfony CI tests failing? The referenced PR is in an unreleased branch of DBAL.
src/Tools/SchemaTool.php
Outdated
@@ -282,7 +286,17 @@ public function getSchemaFromMetadata(array $classes): Schema | |||
} | |||
|
|||
if ($pkColumns !== []) { | |||
$table->setPrimaryKey($pkColumns); | |||
if (class_exists(PrimaryKeyConstraint::class)) { |
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 factor this method out? its repeated three times.
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.
done, not sure though how I can satisfy PHPStan
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.
I think you have to add more lines under
Line 16 in f3fb796
# DBAL 4 compatibility |
ab75661
to
f3620b4
Compare
f3620b4
to
c55f10e
Compare
@xabbuh @nicolas-grekas tell me if I'm wrong, but I think Symfony is deliberately using dev dependencies, including for Doctrine because of Doctrine Bridge (typically, to address deprecations before they hit end users). |
@greg0ire correct. This allows spotting changes as early as possible: bugs, deprecations, etc. And makes adopting new versions of Doctrine way smoother. |
see doctrine/dbal#6867