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

Remove the APIs deprecated in DBAL 3.x #5477

Merged
merged 2 commits into from
Jul 4, 2022
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
19 changes: 19 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ awareness about deprecated code.

# Upgrade to 4.0

## BC BREAK: removed support for custom schema options.

The following `Column` class properties and methods have been removed:

- `$_customSchemaOptions`,
- `setCustomSchemaOption()`,
- `hasCustomSchemaOption()`,
- `getCustomSchemaOption()`,
- `setCustomSchemaOptions()`,
- `getCustomSchemaOptions()`.

## BC BREAK: removed `array` and `object` column types.

The following classes and constants have been removed:
- `ArrayType`,
- `ObjectType`,
- `Types::ARRAY`,
- `Types::OBJECT`.

## BC BREAK: removed `Driver::getSchemaManager()`

The `Driver::getSchemaManager()` method has been removed.
Expand Down
35 changes: 0 additions & 35 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -32,50 +32,15 @@
<file name="src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php"/>
</errorLevel>
</ConflictingReferenceConstraint>
<DeprecatedClass>
<errorLevel type="suppress">
<!--
TODO: remove in 4.0.0
-->
<referencedClass name="Doctrine\DBAL\Types\ArrayType"/>
<referencedClass name="Doctrine\DBAL\Types\ObjectType"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedConstant>
<errorLevel type="suppress">
<!--
TODO: remove in 4.0.0
-->
<file name="src/Types/ArrayType.php"/>
<file name="src/Types/ObjectType.php"/>
<file name="src/Types/Type.php"/>
<file name="tests/Schema/ComparatorTest.php"/>
</errorLevel>
</DeprecatedConstant>
<DeprecatedMethod>
<errorLevel type="suppress">
<!--
This suppression should be removed after 2022
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\Column::getCustomSchemaOption"/>
<referencedMethod name="Doctrine\DBAL\Schema\Column::getCustomSchemaOptions"/>
<referencedMethod name="Doctrine\DBAL\Schema\Column::hasCustomSchemaOption"/>
<referencedMethod name="Doctrine\DBAL\Schema\Column::setCustomSchemaOption"/>
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
<errorLevel type="suppress">
<!--
TODO: remove in 4.0.0
-->
<referencedProperty name="Doctrine\DBAL\Schema\Column::$_customSchemaOptions"/>
</errorLevel>
</DeprecatedProperty>
<DocblockTypeContradiction>
<errorLevel type="suppress">
<!--
Expand Down
84 changes: 1 addition & 83 deletions src/Schema/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Doctrine\DBAL\Schema\Exception\UnknownColumnOption;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;

use function array_merge;
use function method_exists;
Expand Down Expand Up @@ -41,9 +40,6 @@ class Column extends AbstractAsset

protected string $_comment = '';

/** @var array<string, mixed> */
protected array $_customSchemaOptions = [];

/**
* Creates a new Column.
*
Expand Down Expand Up @@ -245,84 +241,6 @@ public function getComment(): string
return $this->_comment;
}

/**
* @deprecated Use {@link setPlatformOption()} instead
*/
public function setCustomSchemaOption(string $name, mixed $value): self
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5476',
'Column::setCustomSchemaOption() is deprecated. Use setPlatformOption() instead.'
);

$this->_customSchemaOptions[$name] = $value;

return $this;
}

/**
* @deprecated Use {@link hasPlatformOption()} instead
*/
public function hasCustomSchemaOption(string $name): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5476',
'Column::hasCustomSchemaOption() is deprecated. Use hasPlatformOption() instead.'
);

return isset($this->_customSchemaOptions[$name]);
}

/**
* @deprecated Use {@link getPlatformOption()} instead
*/
public function getCustomSchemaOption(string $name): mixed
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5476',
'Column::getCustomSchemaOption() is deprecated. Use getPlatformOption() instead.'
);

return $this->_customSchemaOptions[$name];
}

/**
* @deprecated Use {@link setPlatformOptions()} instead
*
* @param array<string, mixed> $customSchemaOptions
*/
public function setCustomSchemaOptions(array $customSchemaOptions): self
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5476',
'Column::setCustomSchemaOptions() is deprecated. Use setPlatformOptions() instead.'
);

$this->_customSchemaOptions = $customSchemaOptions;

return $this;
}

/**
* @deprecated Use {@link getPlatformOptions()} instead
*
* @return array<string, mixed>
*/
public function getCustomSchemaOptions(): array
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5476',
'Column::getCustomSchemaOptions() is deprecated. Use getPlatformOptions() instead.'
);

return $this->_customSchemaOptions;
}

/**
* @return array<string, mixed>
*/
Expand All @@ -341,6 +259,6 @@ public function toArray(): array
'autoincrement' => $this->_autoincrement,
'columnDefinition' => $this->_columnDefinition,
'comment' => $this->_comment,
], $this->_platformOptions, $this->_customSchemaOptions);
], $this->_platformOptions);
}
}
13 changes: 0 additions & 13 deletions src/Schema/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
use Doctrine\DBAL\Types;

use function array_intersect_key;
use function array_key_exists;
use function array_keys;
use function array_map;
use function array_merge;
use function array_unique;
use function assert;
use function count;
Expand Down Expand Up @@ -497,17 +495,6 @@ public function diffColumn(Column $column1, Column $column2): array
$changedProperties[] = 'comment';
}

$customOptions1 = $column1->getCustomSchemaOptions();
$customOptions2 = $column2->getCustomSchemaOptions();

foreach (array_merge(array_keys($customOptions1), array_keys($customOptions2)) as $key) {
if (! array_key_exists($key, $properties1) || ! array_key_exists($key, $properties2)) {
$changedProperties[] = $key;
} elseif ($properties1[$key] !== $properties2[$key]) {
$changedProperties[] = $key;
}
}

$platformOptions1 = $column1->getPlatformOptions();
$platformOptions2 = $column2->getPlatformOptions();

Expand Down
61 changes: 0 additions & 61 deletions src/Types/ArrayType.php

This file was deleted.

60 changes: 0 additions & 60 deletions src/Types/ObjectType.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ abstract class Type
* The map of supported doctrine mapping types.
*/
private const BUILTIN_TYPES_MAP = [
Types::ARRAY => ArrayType::class,
Types::ASCII_STRING => AsciiStringType::class,
Types::BIGINT => BigIntType::class,
Types::BINARY => BinaryType::class,
Expand All @@ -39,7 +38,6 @@ abstract class Type
Types::GUID => GuidType::class,
Types::INTEGER => IntegerType::class,
Types::JSON => JsonType::class,
Types::OBJECT => ObjectType::class,
Types::SIMPLE_ARRAY => SimpleArrayType::class,
Types::SMALLINT => SmallIntType::class,
Types::STRING => StringType::class,
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Schema/ColumnCommentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function columnProvider(): iterable
['length' => 16],
],
'not_commented' => [
'array',
'json',
[],
],
] as $typeName => [$type, $typeOptions]
Expand Down
Loading