-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Doctrine SQL comments not always generated #4845
Comments
@Mediagone could you provide a script that reproduces the issue? |
Hi Morozov, I created this small Symfony project to illustrate the bug : https://github.com/Mediagone/doctrine-custom-types-comment-bug I created two custom Doctrine types, which are declared in
The I generated a migration (with |
@Mediagone if you believe it's a bug in the DBAL, it should be reproducible without any dependencies. Otherwise, the problem can be anywhere else. You may want to seek help from others to convert your Symfony project to a reproducer. |
Using symfony was just simpler since it enables quick type mapping, but it uses Doctrine's It was also a way to integrate the doctrine-migrations package for SQL generation. |
It looks like this issue duplicates #4983 and was fixed by #5077, @Mediagone, please check on |
Indeed, the bug seems to be solved in |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Summary
Despite implementing
requiresSQLCommentHint()
(and returning true) in custom type classes, the(DC2Type:)
comment is not always added to the db.Missing comments are causing problems like endless diff generation, etc.
How to reproduce
It happens when the type is declared with a different name from the one returned by the type's
getName
method.eg.
We can see the types are registered in the TypeRegistry using the supplied custom name:
When looking in the AbstractPlatform, we can see that type's name (the one supplied to Type::register) is stored when the custom type requires a comment.
However, in the next method, we can see that the
getName()
's name is used to check if the type requires an SQL comment, resulting in the class being not detected as commented :I don't know enough Doctrine code to be sure, but maybe registering the type's class name instead of the type name would solve the issue.
Also, what are the purposes of this
getName
method if we can define the type name elsewhere ?The text was updated successfully, but these errors were encountered: