Skip to content

Commit b555b64

Browse files
authored
Remove deprecations (#1091)
1 parent 512ee13 commit b555b64

12 files changed

Lines changed: 7 additions & 516 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## 2.0.0 under development
44

5+
- Chg #1091: Remove `SchemaInterface::findUniqueIndexes()` method (@vjik)
6+
- Chg #1091: Remove `SchemaInterface::INDEX_*` and `SchemaInterface::TYPE_*` constants (@vjik)
57
- Enh #996: Adapt summary data in debug collector (@rustamwin)
68
- Chg #990: Delete `Yiisoft\Db\Exception\InvalidArgumentException` and `Yiisoft\Db\Exception\InvalidParamException` and
79
use `\InvalidArgumentException` instead (@DikoIbragimov)

UPGRADE.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ Each table column has its own class in the `Yiisoft\Db\Schema\Column` namespace
185185
- `TableSchemaInterface::compositeForeignKey()`;
186186
- `SchemaInterface::createColumn()` - use `ColumnBuilder` instead;
187187
- `SchemaInterface::isReadQuery()` - use `DbStringHelper::isReadQuery()` instead;
188-
- `AbstractSchema::resolveTableName()` - use `QuoterInterface::getTableNameParts()` instead;
188+
- `SchemaInterface::findUniqueIndexes()` - use `SchemaInterface::getTableUniques()` instead;
189189
- `SchemaInterface::getRawTableName()` - use `QuoterInterface::getRawTableName()` instead;
190+
- `AbstractSchema::resolveTableName()` - use `QuoterInterface::getTableNameParts()` instead;
190191
- `AbstractSchema::isReadQuery()` - use `DbStringHelper::isReadQuery()` instead;
191192
- `AbstractSchema::getRawTableName()` - use `QuoterInterface::getRawTableName()` instead;
192193
- `AbstractSchema::normalizeRowKeyCase()` - use `array_change_key_case()` instead;
@@ -215,14 +216,9 @@ Each table column has its own class in the `Yiisoft\Db\Schema\Column` namespace
215216

216217
### Remove constants
217218

218-
- `SchemaInterface::TYPE_JSONB`
219-
- `SchemaInterface::PHP_TYPE_INTEGER`
220-
- `SchemaInterface::PHP_TYPE_STRING`
221-
- `SchemaInterface::PHP_TYPE_BOOLEAN`
222-
- `SchemaInterface::PHP_TYPE_DOUBLE`
223-
- `SchemaInterface::PHP_TYPE_RESOURCE`
224-
- `SchemaInterface::PHP_TYPE_ARRAY`
225-
- `SchemaInterface::PHP_TYPE_NULL`
219+
- `SchemaInterface::INDEX_*`
220+
- `SchemaInterface::PHP_TYPE_*`
221+
- `SchemaInterface::TYPE_*`
226222

227223
### Other changes
228224

src/Command/AbstractCommand.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,6 @@ public function alterColumn(string $table, string $column, ColumnInterface|strin
200200
return $this->setSql($sql)->requireTableSchemaRefresh($table);
201201
}
202202

203-
/**
204-
* @param string[] $columns
205-
*
206-
* @psalm-param BatchValues $rows
207-
*
208-
* @deprecated Use {@see insertBatch()} instead. It will be removed in version 3.0.0.
209-
*/
210-
public function batchInsert(string $table, array $columns, iterable $rows): static
211-
{
212-
return $this->insertBatch($table, $rows, $columns);
213-
}
214-
215203
public function insertBatch(string $table, iterable $rows, array $columns = []): static
216204
{
217205
$table = $this->getQueryBuilder()->getQuoter()->getRawTableName($table);
@@ -396,14 +384,6 @@ public function insertReturningPks(string $table, array|QueryInterface $columns)
396384
return $this->queryInternal(self::QUERY_MODE_ROW | self::QUERY_MODE_EXECUTE);
397385
}
398386

399-
/**
400-
* @deprecated Use {@see insertReturningPks()} instead. It will be removed in version 3.0.0.
401-
*/
402-
public function insertWithReturningPks(string $table, array|QueryInterface $columns): array|false
403-
{
404-
return $this->insertReturningPks($table, $columns);
405-
}
406-
407387
public function execute(): int
408388
{
409389
$sql = $this->getSql();

src/QueryBuilder/AbstractDMLQueryBuilder.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,6 @@ public function __construct(
6464
protected SchemaInterface $schema,
6565
) {}
6666

67-
/**
68-
* @param string[] $columns
69-
*
70-
* @psalm-param BatchValues $rows
71-
* @psalm-param ParamsType $params
72-
*
73-
* @deprecated Use {@see insertBatch()} instead. It will be removed in version 3.0.0.
74-
*/
75-
public function batchInsert(string $table, array $columns, iterable $rows, array &$params = []): string
76-
{
77-
return $this->insertBatch($table, $rows, $columns, $params);
78-
}
79-
8067
public function insertBatch(string $table, iterable $rows, array $columns = [], array &$params = []): string
8168
{
8269
if (!is_array($rows)) {

src/QueryBuilder/AbstractQueryBuilder.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,6 @@ public function alterColumn(string $table, string $column, ColumnInterface|strin
144144
return $this->ddlBuilder->alterColumn($table, $column, $type);
145145
}
146146

147-
/**
148-
* @param string[] $columns
149-
*
150-
* @psalm-param BatchValues $rows
151-
* @psalm-param ParamsType $params
152-
*
153-
* @deprecated Use {@see insertBatch()} instead. It will be removed in version 3.0.0.
154-
*/
155-
public function batchInsert(string $table, array $columns, iterable $rows, array &$params = []): string
156-
{
157-
return $this->dmlBuilder->insertBatch($table, $rows, $columns, $params);
158-
}
159-
160147
public function insertBatch(string $table, iterable $rows, array $columns = [], array &$params = []): string
161148
{
162149
return $this->dmlBuilder->insertBatch($table, $rows, $columns, $params);

src/Schema/AbstractSchema.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,6 @@ public function enableCache(bool $value): void
253253
$this->schemaCache->setEnabled($value);
254254
}
255255

256-
/**
257-
* @deprecated Use {@see getTableUniques()}. Will be removed in version 3.0
258-
*/
259-
public function findUniqueIndexes(TableSchemaInterface $table): array
260-
{
261-
$uniques = [];
262-
$indexes = $this->getTableIndexes($table->getFullName());
263-
264-
foreach ($indexes as $index) {
265-
if ($index->isUnique) {
266-
$uniques[$index->name] = $index->columnNames;
267-
}
268-
}
269-
270-
return $uniques;
271-
}
272-
273256
public function getViewNames(string $schema = '', bool $refresh = false): array
274257
{
275258
if (!isset($this->viewNames[$schema]) || $refresh) {

src/Schema/Column/AbstractColumn.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,6 @@ public function __construct(
110110
}
111111
}
112112

113-
/**
114-
* @deprecated Use {@see notNull()} instead. Will be removed in version 2.0.
115-
*/
116-
public function allowNull(bool $allowNull = true): static
117-
{
118-
$this->notNull(!$allowNull);
119-
return $this;
120-
}
121-
122113
public function autoIncrement(bool $autoIncrement = true): static
123114
{
124115
$this->autoIncrement = $autoIncrement;
@@ -239,15 +230,6 @@ public function hasDefaultValue(): bool
239230
return property_exists($this, 'defaultValue');
240231
}
241232

242-
/**
243-
* @deprecated Use {@see isNotNull()} instead. Will be removed in version 2.0.
244-
* @psalm-mutation-free
245-
*/
246-
public function isAllowNull(): bool
247-
{
248-
return !$this->isNotNull();
249-
}
250-
251233
/** @psalm-mutation-free */
252234
public function isAutoIncrement(): bool
253235
{
@@ -284,15 +266,6 @@ public function isUnsigned(): bool
284266
return $this->unsigned;
285267
}
286268

287-
/**
288-
* @deprecated Will be removed in version 2.0.
289-
*/
290-
public function name(?string $name): static
291-
{
292-
$this->name = $name;
293-
return $this;
294-
}
295-
296269
public function notNull(?bool $notNull = true): static
297270
{
298271
$this->notNull = $notNull;

src/Schema/Column/ColumnInterface.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@
1212
*/
1313
interface ColumnInterface
1414
{
15-
/**
16-
* Whether to allow `null` values.
17-
*
18-
* If not set explicitly with this method call, `null` values aren't allowed.
19-
*
20-
* ```php
21-
* $columns = [
22-
* 'description' => ColumnBuilder::text()->allowNull(),
23-
* ];
24-
* ```
25-
*
26-
* @deprecated Use {@see notNull()} instead. Will be removed in version 2.0.
27-
*/
28-
public function allowNull(bool $allowNull = true): static;
29-
3015
/**
3116
* The database assigns auto incremented column a unique value automatically whenever you insert a new row into
3217
* the table. This is useful for getting unique IDs for data such as customer or employee numbers.
@@ -237,16 +222,6 @@ public function getType(): string;
237222
/** @psalm-mutation-free */
238223
public function hasDefaultValue(): bool;
239224

240-
/**
241-
* Whether this column is nullable.
242-
*
243-
* @see allowNull()
244-
*
245-
* @deprecated Use {@see isNotNull()} instead. Will be removed in version 2.0.
246-
* @psalm-mutation-free
247-
*/
248-
public function isAllowNull(): bool;
249-
250225
/**
251226
* Whether this column is auto incremental.
252227
*

0 commit comments

Comments
 (0)