diff --git a/CHANGELOG.md b/CHANGELOG.md index 88591b25c..777db4fda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ - New #407: Use `DateTimeColumn` class for datetime column types (@Tigrov) - New #408, #410: Implement `DMLQueryBuilder::upsertReturning()` method (@Tigrov) - Enh #412: Reduce binding parameters (@Tigrov) +- Chg #414: Rename `DMLQueryBuilder::insertWithReturningPks()` to `DMLQueryBuilder::insertReturningPks()` (@Tigrov) ## 1.3.0 March 21, 2024 diff --git a/src/DMLQueryBuilder.php b/src/DMLQueryBuilder.php index 847932d59..778d7849a 100644 --- a/src/DMLQueryBuilder.php +++ b/src/DMLQueryBuilder.php @@ -19,7 +19,7 @@ */ final class DMLQueryBuilder extends AbstractDMLQueryBuilder { - public function insertWithReturningPks(string $table, array|QueryInterface $columns, array &$params = []): string + public function insertReturningPks(string $table, array|QueryInterface $columns, array &$params = []): string { $insertSql = $this->insert($table, $columns, $params); $tableSchema = $this->schema->getTableSchema($table); diff --git a/tests/CommandTest.php b/tests/CommandTest.php index cbf75a12d..8a3a5ebfb 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -199,12 +199,12 @@ public function testUpsert(array $firstData, array $secondData): void parent::testUpsert($firstData, $secondData); } - public function testinsertWithReturningPksUuid(): void + public function testInsertReturningPksUuid(): void { $db = $this->getConnection(true); $command = $db->createCommand(); - $result = $command->insertWithReturningPks( + $result = $command->insertReturningPks( '{{%table_uuid}}', [ 'col' => 'test', diff --git a/tests/PdoCommandTest.php b/tests/PdoCommandTest.php index d9effc1c7..843352f8a 100644 --- a/tests/PdoCommandTest.php +++ b/tests/PdoCommandTest.php @@ -42,7 +42,7 @@ public function testInsertAndReadToArrayColumn(): void $db = $this->getConnection(true); $arrValue = [1, 2, 3, 4]; - $insertedData = $db->createCommand()->insertWithReturningPks('{{%table_with_array_col}}', ['array_col' => $arrValue]); + $insertedData = $db->createCommand()->insertReturningPks('{{%table_with_array_col}}', ['array_col' => $arrValue]); $this->assertGreaterThan(0, $insertedData['id']); @@ -90,8 +90,8 @@ public function testCommandLogging(): void $command->execute(); $sql = 'INSERT INTO "customer" ("name", "email") VALUES (\'test\', \'email@email\') RETURNING "id"'; - $command->setLogger($this->createQueryLogger($sql, ['Yiisoft\Db\Driver\Pdo\AbstractPdoCommand::insertWithReturningPks'])); - $command->insertWithReturningPks('{{%customer}}', ['name' => 'test', 'email' => 'email@email']); + $command->setLogger($this->createQueryLogger($sql, ['Yiisoft\Db\Driver\Pdo\AbstractPdoCommand::insertReturningPks'])); + $command->insertReturningPks('{{%customer}}', ['name' => 'test', 'email' => 'email@email']); $db->close(); } diff --git a/tests/Provider/QueryBuilderProvider.php b/tests/Provider/QueryBuilderProvider.php index d5b987e9a..928efb236 100644 --- a/tests/Provider/QueryBuilderProvider.php +++ b/tests/Provider/QueryBuilderProvider.php @@ -119,7 +119,7 @@ public static function insert(): array return $insert; } - public static function insertWithReturningPks(): array + public static function insertReturningPks(): array { return [ 'regular-values' => [ diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index dc6b30cb4..10b422f72 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -295,15 +295,15 @@ public function testInsert( parent::testInsert($table, $columns, $params, $expectedSQL, $expectedParams); } - #[DataProviderExternal(QueryBuilderProvider::class, 'insertWithReturningPks')] - public function testInsertWithReturningPks( + #[DataProviderExternal(QueryBuilderProvider::class, 'insertReturningPks')] + public function testInsertReturningPks( string $table, array|QueryInterface $columns, array $params, string $expectedSQL, array $expectedParams ): void { - parent::testInsertWithReturningPks($table, $columns, $params, $expectedSQL, $expectedParams); + parent::testInsertReturningPks($table, $columns, $params, $expectedSQL, $expectedParams); } public function testRenameTable(): void