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

Deprecate AbstractPlatform commented type APIs #5058

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

greg0ire
Copy link
Member

The Type class already has an API for this.

@greg0ire greg0ire marked this pull request as ready for review December 1, 2021 06:51
@@ -95,6 +95,13 @@ protected function initializeDoctrineTypeMappings()
*/
public function isCommentedDoctrineType(Type $doctrineType)
{
Deprecation::trigger(
'doctrine/dbal',
'TODO',
Copy link
Member

Choose a reason for hiding this comment

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

A link is missing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Dang! I did a @derrabus !

*/
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return $platform instanceof DB2Platform;
Copy link
Member

Choose a reason for hiding this comment

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

// We require a commented boolean type in order to distinguish between boolean and smallint
// as both (have to) map to the same native type.

AFAIK, only PostgreSQL natively supports boolean columns but they work on all supported platforms. Is it really necessary to use a comment hint on DB2?

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 forgot to copy the comment I found in DB2Platform, it explains why this is necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it really necessary to use a comment hint on DB2?

I have added the comment, and now I am wondering if we shouldn't require a comment on all platforms but PG

Copy link
Member

@morozov morozov Dec 1, 2021

Choose a reason for hiding this comment

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

now I am wondering if we shouldn't require a comment on all platforms but PG

I guess it's the opposite and (I misread it as should) we don't need it anywhere (at least with the platform-aware schema comparison in place). We need to find a relevant schema comparison test and see how a scenario of deployment and comparison of a boolean column works say on MySQL.

Copy link
Member Author

@greg0ire greg0ire Dec 1, 2021

Choose a reason for hiding this comment

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

You read correctly, my sentence has the same meaning with or without n't (in my intention, now you make me realize what I wrote is properly incorrect english).

I don't understand why you say it would work. If MySQL does not have native support for boolean columns, why would the DBAL reverse engineer to BooleanType and not SmallIntType? Or is schema comparison working and not reverse engineering?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not certain it does work, I'm just saying I'm not aware of any related issues, so it may work somehow. We need more testing to understand the details. If it doesn't work anywhere except for PostgreSQL, then it's a separate bug.

On the other hand, the changes here are in line with the existing logic, so this unknown probably shouldn't block the deprecation.

Copy link
Member Author

Choose a reason for hiding this comment

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

then it's a separate bug.

If it's a bug, then it must be separate because it should target 3.2.x, one more reason not to block this. Plus I have other rabbit holes to dig into :P

The Type class already has an API for this.
@greg0ire greg0ire added this to the 3.3.0 milestone Dec 1, 2021
@greg0ire greg0ire merged commit 39d41f0 into doctrine:3.3.x Dec 1, 2021
This was referenced Dec 1, 2021
@greg0ire greg0ire deleted the deprecate-mark-commented branch January 20, 2022 21:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants