-
-
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
Validation schema failure after disabling DC2Type generation in Doctrine #6422
Comments
What do you mean by that? |
I mean that if I add these lines back:
the error will disappear. However, then what is the point of As I understand it, this option is supposed to simplify the transition to ORM 3, where these comments are not used, but it does not work as I expect. |
Ok I get it now. I think you've found a bug, there should be no error indeed. There must be some place in the code where In case you want to debug, the comparison happens here: https://github.com/doctrine/orm/blob/3a7d7c9f574517a19239523026e603b9dfed33bc/src/Tools/SchemaTool.php#L980-L997 Can you check whether you go through this line: https://github.com/doctrine/orm/blob/3a7d7c9f574517a19239523026e603b9dfed33bc/src/Tools/SchemaTool.php#L984 ? |
I tried debugging and found the following: Here dbal/src/Schema/Comparator.php Line 324 in 080aab5
we have data from the database that doesn't have types because comments are missing. We compare this with $toTableColumns , which has types, so there will always be differences when comparing.
Here the table properties are compared: dbal/src/Schema/Comparator.php Lines 622 to 623 in 080aab5
As seen in the screenshot, the property types are different and UPD: However, if the purpose of the variable |
The goal of the filter is to remove tables not managed by Doctrine, or the migrations table which is a special case. |
I notice that |
dbal/src/Schema/Comparator.php Line 348 in 080aab5
|
That's EDIT: my bad, I should have asked for |
As you can see here dbal/src/Schema/Comparator.php Lines 350 to 356 in 080aab5
platform is not null , then it does not matter if $changedProperties is not empty.
|
2 different columns will be considered equal if they lead to the same column declaration SQL: that's what the platform-aware comparison is all about. Therefore, dumping both column object is not enough to prove that they are different. |
Yeah it pass correctly column declaration SQL here: dbal/src/Platforms/AbstractPlatform.php Lines 4676 to 4678 in 080aab5
But this line ruins everything: dbal/src/Platforms/AbstractPlatform.php Line 4696 in 080aab5
I suppose there should be: if($this->disableTypeComments){
return true;
}
return $column1->getType() === $column2->getType(); UPD: |
I've had the exact same conversation 3 weeks ago in fact: #6257 (comment) 😅 |
Oh... I see, and the solution is exactly the same. I feel strange right now. :D |
Maybe you're going to be the one contributing the fix ? 🙏 |
Alright, I'll give it a try. It doesn't seem too difficult. |
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. |
Hello,
I have some issues. According to this doctrine/DoctrineBundle#1714, it is possible to disable
DC2Type
generation. However, after enabling it, it is no longer possible to passdoctrine:schema:validate
for the database. And it doesn't even work fordate*_immutable
types.Here is an example of my code.
Initial migration:
Configuration:
Entity:
When I run
doctrine:schema:validate -v
, I get the following output expecting DC2Type.Am I doing something wrong, or am I misunderstanding something, or is this a bug?
Thanks.
The text was updated successfully, but these errors were encountered: