Skip to content

Commit 0c41dea

Browse files
authored
Rename insertWithReturningPks() to insertReturningPks() (#414)
1 parent 4ee546b commit 0c41dea

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- New #407: Use `DateTimeColumn` class for datetime column types (@Tigrov)
4343
- New #408, #410: Implement `DMLQueryBuilder::upsertReturning()` method (@Tigrov)
4444
- Enh #412: Reduce binding parameters (@Tigrov)
45+
- Chg #414: Rename `DMLQueryBuilder::insertWithReturningPks()` to `DMLQueryBuilder::insertReturningPks()` (@Tigrov)
4546

4647
## 1.3.0 March 21, 2024
4748

src/DMLQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
final class DMLQueryBuilder extends AbstractDMLQueryBuilder
2121
{
22-
public function insertWithReturningPks(string $table, array|QueryInterface $columns, array &$params = []): string
22+
public function insertReturningPks(string $table, array|QueryInterface $columns, array &$params = []): string
2323
{
2424
$insertSql = $this->insert($table, $columns, $params);
2525
$tableSchema = $this->schema->getTableSchema($table);

tests/CommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ public function testUpsert(array $firstData, array $secondData): void
199199
parent::testUpsert($firstData, $secondData);
200200
}
201201

202-
public function testinsertWithReturningPksUuid(): void
202+
public function testInsertReturningPksUuid(): void
203203
{
204204
$db = $this->getConnection(true);
205205

206206
$command = $db->createCommand();
207-
$result = $command->insertWithReturningPks(
207+
$result = $command->insertReturningPks(
208208
'{{%table_uuid}}',
209209
[
210210
'col' => 'test',

tests/PdoCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testInsertAndReadToArrayColumn(): void
4242
$db = $this->getConnection(true);
4343

4444
$arrValue = [1, 2, 3, 4];
45-
$insertedData = $db->createCommand()->insertWithReturningPks('{{%table_with_array_col}}', ['array_col' => $arrValue]);
45+
$insertedData = $db->createCommand()->insertReturningPks('{{%table_with_array_col}}', ['array_col' => $arrValue]);
4646

4747
$this->assertGreaterThan(0, $insertedData['id']);
4848

@@ -90,8 +90,8 @@ public function testCommandLogging(): void
9090
$command->execute();
9191

9292
$sql = 'INSERT INTO "customer" ("name", "email") VALUES (\'test\', \'email@email\') RETURNING "id"';
93-
$command->setLogger($this->createQueryLogger($sql, ['Yiisoft\Db\Driver\Pdo\AbstractPdoCommand::insertWithReturningPks']));
94-
$command->insertWithReturningPks('{{%customer}}', ['name' => 'test', 'email' => 'email@email']);
93+
$command->setLogger($this->createQueryLogger($sql, ['Yiisoft\Db\Driver\Pdo\AbstractPdoCommand::insertReturningPks']));
94+
$command->insertReturningPks('{{%customer}}', ['name' => 'test', 'email' => 'email@email']);
9595

9696
$db->close();
9797
}

tests/Provider/QueryBuilderProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static function insert(): array
119119
return $insert;
120120
}
121121

122-
public static function insertWithReturningPks(): array
122+
public static function insertReturningPks(): array
123123
{
124124
return [
125125
'regular-values' => [

tests/QueryBuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ public function testInsert(
295295
parent::testInsert($table, $columns, $params, $expectedSQL, $expectedParams);
296296
}
297297

298-
#[DataProviderExternal(QueryBuilderProvider::class, 'insertWithReturningPks')]
299-
public function testInsertWithReturningPks(
298+
#[DataProviderExternal(QueryBuilderProvider::class, 'insertReturningPks')]
299+
public function testInsertReturningPks(
300300
string $table,
301301
array|QueryInterface $columns,
302302
array $params,
303303
string $expectedSQL,
304304
array $expectedParams
305305
): void {
306-
parent::testInsertWithReturningPks($table, $columns, $params, $expectedSQL, $expectedParams);
306+
parent::testInsertReturningPks($table, $columns, $params, $expectedSQL, $expectedParams);
307307
}
308308

309309
public function testRenameTable(): void

0 commit comments

Comments
 (0)