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

Revert GUID type deprecation #4726

Merged
merged 2 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ The following `AbstractPlatform` methods and their implementations in specific p

If required by the target platform(s), the column length should be specified based on the application logic.

## Deprecated `AbstractPlatform::hasNativeGuidType()`

The `AbstractPlatform::hasNativeGuidType()` method and its implementations in specific platforms have been deprecated
since it was only needed to support the Guid data type the support for which was dropped in 3.0.0.

## Deprecated static calls to `Comparator::compareSchemas($fromSchema, $toSchema)`

The usage of `Comparator::compareSchemas($fromSchema, $toSchema)` statically is
Expand Down
5 changes: 0 additions & 5 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
-->
<referencedClass name="Doctrine\DBAL\Id\TableGenerator"/>
<referencedClass name="Doctrine\DBAL\Id\TableGeneratorSchemaVisitor"/>
<!--
TODO: remove in 4.0.0
-->
<referencedClass name="Doctrine\DBAL\Types\GuidType" />
</errorLevel>
</DeprecatedClass>
<DeprecatedMethod>
Expand Down Expand Up @@ -116,7 +112,6 @@
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::hasNativeGuidType" />
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getBinaryDefaultLength"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getBinaryMaxLength"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getIsNullExpression"/>
Expand Down
8 changes: 0 additions & 8 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -3542,18 +3542,10 @@ public function supportsCommentOnStatement()
/**
* Does this platform have native guid type.
*
* @deprecated
*
* @return bool
*/
public function hasNativeGuidType()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3167',
'AbstractPlatform::hasNativeGuidType() is deprecated.'
);

return false;
}

Expand Down
8 changes: 0 additions & 8 deletions src/Platforms/PostgreSQL94Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,9 @@ public function supportsCommentOnStatement()

/**
* {@inheritDoc}
*
* @deprecated
*/
public function hasNativeGuidType()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3167',
'PostgreSQL94Platform::hasNativeGuidType() is deprecated.'
);

return true;
}

Expand Down
8 changes: 0 additions & 8 deletions src/Platforms/SQLServer2012Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,9 @@ public function getSequenceNextValSQL($sequence)

/**
* {@inheritDoc}
*
* @deprecated
*/
public function hasNativeGuidType()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3167',
'SQLServer2012::hasNativeGuidType() is deprecated.'
);

return true;
}

Expand Down
2 changes: 0 additions & 2 deletions src/Types/GuidType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Represents a GUID/UUID datatype (both are actually synonyms) in the database.
*
* @deprecated Generate UUIDs on the application side.
*/
class GuidType extends StringType
{
Expand Down
36 changes: 36 additions & 0 deletions tests/Functional/Types/GuidTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Tests\Functional\Types;

use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;

class GuidTest extends FunctionalTestCase
{
protected function setUp(): void
{
parent::setUp();

$table = new Table('guid_table');
$table->addColumn('guid', 'guid');

$this->connection->createSchemaManager()->dropAndCreateTable($table);
}

public function testInsertAndSelect(): void
{
$guid = '7c620eda-ea79-11eb-9a03-0242ac130003';

$result = $this->connection->insert('guid_table', ['guid' => $guid]);
self::assertSame(1, $result);

$value = $this->connection->fetchOne('SELECT guid FROM guid_table');

// the platforms with native UUID support inconsistently format the binary value
// as a string using the lower or the upper case; this is acceptable since
// regardless of the case they encode the same binary value
self::assertEqualsIgnoringCase($guid, $value);
}
}