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 TableSchemaInterface::compositeForeignKey() method #839

Merged
merged 2 commits into from
May 9, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Chg #837: Remove `$table` parameter from `normalizeColumnNames()` and `getNormalizeColumnNames()` methods
of `AbstractDMLQueryBuilder` class (@Tigrov)
- Chg #838: Remove `SchemaInterface::TYPE_JSONB` constant (@Tigrov)
- Chg #839: Remove `TableSchemaInterface::compositeForeignKey()` method (@Tigrov)

## 1.3.0 March 21, 2024

Expand Down
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ $db->createCommand()->insertBatch('user', $values)->execute();
### Remove deprecated methods

- `AbstractDMLQueryBuilder::getTypecastValue()`
- `TableSchemaInterface::compositeForeignKey()`

### Remove deprecated parameters

Expand Down
7 changes: 0 additions & 7 deletions src/Schema/AbstractTableSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Yiisoft\Db\Schema;

use Yiisoft\Db\Exception\NotSupportedException;

use function array_keys;

/**
Expand Down Expand Up @@ -152,9 +150,4 @@ public function foreignKey(string|int $id, array $to): void
{
$this->foreignKeys[$id] = $to;
}

public function compositeForeignKey(int $id, string $from, string $to): void
{
throw new NotSupportedException(static::class . ' does not support composite FK.');
}
}
15 changes: 0 additions & 15 deletions src/Schema/TableSchemaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Yiisoft\Db\Schema;

use Yiisoft\Db\Exception\NotSupportedException;

/**
* Represents the metadata of a database table.
*
Expand Down Expand Up @@ -201,17 +199,4 @@ public function foreignKeys(array $value): void;
* @param array $to The foreign key.
*/
public function foreignKey(string|int $id, array $to): void;

/**
* Set composite foreign key.
*
* @param int $id The index of foreign key.
* @param string $from The column name in current table.
* @param string $to The column name in foreign table.
*
* @throws NotSupportedException
*
* @deprecated will be removed in version 2.0.0
*/
public function compositeForeignKey(int $id, string $from, string $to): void;
}
11 changes: 0 additions & 11 deletions tests/AbstractTableSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Yiisoft\Db\Tests;

use PHPUnit\Framework\TestCase;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Tests\Support\Stub\ColumnSchema;
use Yiisoft\Db\Tests\Support\Stub\TableSchema;
use Yiisoft\Db\Tests\Support\TestTrait;
Expand All @@ -14,16 +13,6 @@ abstract class AbstractTableSchemaTest extends TestCase
{
use TestTrait;

public function testCompositeFk(): void
{
$tableSchema = new TableSchema();

$this->expectException(NotSupportedException::class);
$this->expectExceptionMessage('Yiisoft\Db\Tests\Support\Stub\TableSchema does not support composite FK.');

$tableSchema->compositeForeignKey(1, 'from', 'to');
}

public function testGetCatalogName(): void
{
$tableSchema = new TableSchema();
Expand Down
Loading