Skip to content
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 @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/DMLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions tests/PdoCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/QueryBuilderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static function insert(): array
return $insert;
}

public static function insertWithReturningPks(): array
public static function insertReturningPks(): array
{
return [
'regular-values' => [
Expand Down
6 changes: 3 additions & 3 deletions tests/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down