Skip to content

Commit 1cc0f29

Browse files
authored
Merge pull request #6640 from morozov/remove-altering-table-configuration
Remove support for altering table configuration
2 parents efe2095 + e8e51f8 commit 1cc0f29

File tree

4 files changed

+14
-57
lines changed

4 files changed

+14
-57
lines changed

UPGRADE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ awareness about deprecated code.
88

99
# Upgrade to 5.0
1010

11+
## BC BREAK: Removed support for altering `Table` configuration
12+
13+
The `Table::setSchemaConfig()` and `::_getMaxIdentifierLength()` methods and the `Table::$_schemaConfig` property have
14+
been removed.
15+
1116
## BC BREAK: Removed `AbstractAsset::_setName()`
1217

1318
The `AbstractAsset::_setName()` method has been removed.

psalm.xml.dist

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,8 @@
5555

5656
<!-- TODO for PHPUnit 11 -->
5757
<referencedMethod name="PHPUnit\Framework\TestCase::iniSet"/>
58-
59-
<!--
60-
https://github.com/doctrine/dbal/pull/6635
61-
TODO: remove in 5.0.0
62-
-->
63-
<referencedMethod name="Doctrine\DBAL\Schema\Table::_getMaxIdentifierLength" />
64-
<referencedMethod name="Doctrine\DBAL\Schema\Table::setSchemaConfig" />
6558
</errorLevel>
6659
</DeprecatedMethod>
67-
<DeprecatedProperty>
68-
<errorLevel type="suppress">
69-
<!--
70-
https://github.com/doctrine/dbal/pull/6635
71-
TODO: remove in 5.0.0
72-
-->
73-
<referencedProperty name="Doctrine\DBAL\Schema\Table::$_schemaConfig" />
74-
</errorLevel>
75-
</DeprecatedProperty>
7660
<DocblockTypeContradiction>
7761
<errorLevel type="suppress">
7862
<!--

src/Schema/Schema.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public function __construct(
8383
}
8484

8585
foreach ($tables as $table) {
86-
$table->setSchemaConfig($this->_schemaConfig);
8786
$this->_addTable($table);
8887
}
8988

src/Schema/Table.php

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ class Table extends AbstractAsset
6161
'create_options' => [],
6262
];
6363

64-
/** @deprecated Pass a {@link TableConfiguration} instance to the constructor instead. */
65-
protected ?SchemaConfig $_schemaConfig = null;
66-
67-
private int $maxIdentifierLength;
64+
private readonly int $maxIdentifierLength;
6865

6966
/**
7067
* @param array<Column> $columns
@@ -111,21 +108,6 @@ public function __construct(
111108
$this->_options = array_merge($this->_options, $options);
112109
}
113110

114-
/** @deprecated Pass a {@link TableConfiguration} instance to the constructor instead. */
115-
public function setSchemaConfig(SchemaConfig $schemaConfig): void
116-
{
117-
Deprecation::triggerIfCalledFromOutside(
118-
'doctrine/dbal',
119-
'https://github.com/doctrine/dbal/pull/6635',
120-
'%s is deprecated. Pass TableConfiguration to the constructor instead.',
121-
__METHOD__,
122-
);
123-
124-
$this->_schemaConfig = $schemaConfig;
125-
126-
$this->maxIdentifierLength = $schemaConfig->getMaxIdentifierLength();
127-
}
128-
129111
/**
130112
* Sets the Primary Key.
131113
*
@@ -161,7 +143,7 @@ public function addUniqueConstraint(
161143
$indexName ??= $this->_generateIdentifierName(
162144
array_merge([$this->getName()], $columnNames),
163145
'uniq',
164-
$this->_getMaxIdentifierLength(),
146+
$this->maxIdentifierLength,
165147
);
166148

167149
return $this->_addUniqueConstraint($this->_createUniqueConstraint($columnNames, $indexName, $flags, $options));
@@ -181,7 +163,7 @@ public function addIndex(
181163
$indexName ??= $this->_generateIdentifierName(
182164
array_merge([$this->getName()], $columnNames),
183165
'idx',
184-
$this->_getMaxIdentifierLength(),
166+
$this->maxIdentifierLength,
185167
);
186168

187169
return $this->_addIndex($this->_createIndex($columnNames, $indexName, false, false, $flags, $options));
@@ -223,7 +205,7 @@ public function addUniqueIndex(array $columnNames, ?string $indexName = null, ar
223205
$indexName ??= $this->_generateIdentifierName(
224206
array_merge([$this->getName()], $columnNames),
225207
'uniq',
226-
$this->_getMaxIdentifierLength(),
208+
$this->maxIdentifierLength,
227209
);
228210

229211
return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false, [], $options));
@@ -408,7 +390,7 @@ public function addForeignKeyConstraint(
408390
$name ??= $this->_generateIdentifierName(
409391
array_merge([$this->getName()], $localColumnNames),
410392
'fk',
411-
$this->_getMaxIdentifierLength(),
393+
$this->maxIdentifierLength,
412394
);
413395

414396
foreach ($localColumnNames as $columnName) {
@@ -641,19 +623,6 @@ public function __clone()
641623
}
642624
}
643625

644-
/** @deprecated */
645-
protected function _getMaxIdentifierLength(): int
646-
{
647-
Deprecation::triggerIfCalledFromOutside(
648-
'doctrine/dbal',
649-
'https://github.com/doctrine/dbal/pull/6635',
650-
'%s is deprecated.',
651-
__METHOD__,
652-
);
653-
654-
return $this->maxIdentifierLength;
655-
}
656-
657626
protected function _addColumn(Column $column): void
658627
{
659628
$columnName = $column->getName();
@@ -715,7 +684,7 @@ protected function _addUniqueConstraint(UniqueConstraint $constraint): self
715684
: $this->_generateIdentifierName(
716685
array_merge((array) $this->getName(), $constraint->getColumns()),
717686
'fk',
718-
$this->_getMaxIdentifierLength(),
687+
$this->maxIdentifierLength,
719688
);
720689

721690
$name = $this->normalizeIdentifier($name);
@@ -728,7 +697,7 @@ protected function _addUniqueConstraint(UniqueConstraint $constraint): self
728697
$indexName = $this->_generateIdentifierName(
729698
array_merge([$this->getName()], $constraint->getColumns()),
730699
'idx',
731-
$this->_getMaxIdentifierLength(),
700+
$this->maxIdentifierLength,
732701
);
733702

734703
$indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, true, false);
@@ -751,7 +720,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint): s
751720
: $this->_generateIdentifierName(
752721
array_merge((array) $this->getName(), $constraint->getLocalColumns()),
753722
'fk',
754-
$this->_getMaxIdentifierLength(),
723+
$this->maxIdentifierLength,
755724
);
756725

757726
$name = $this->normalizeIdentifier($name);
@@ -765,7 +734,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint): s
765734
$indexName = $this->_generateIdentifierName(
766735
array_merge([$this->getName()], $constraint->getLocalColumns()),
767736
'idx',
768-
$this->_getMaxIdentifierLength(),
737+
$this->maxIdentifierLength,
769738
);
770739

771740
$indexCandidate = $this->_createIndex($constraint->getLocalColumns(), $indexName, false, false);

0 commit comments

Comments
 (0)