Skip to content

Commit 4fbb78d

Browse files
authored
Rename getLastInsertID() method in ConnectionInterface to getLastInsertId() (#392)
1 parent d6336dc commit 4fbb78d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Command.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function insertWithReturningPks(string $table, array $columns): array|fal
3434

3535
foreach ($tablePrimaryKeys as $name) {
3636
if ($tableSchema?->getColumn($name)?->isAutoIncrement()) {
37-
$result[$name] = $this->db->getLastInsertID((string) $tableSchema?->getSequenceName());
37+
$result[$name] = $this->db->getLastInsertId((string) $tableSchema?->getSequenceName());
3838
continue;
3939
}
4040

tests/PdoConnectionTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testGetLastInsertID(): void
6464
SQL
6565
)->execute();
6666

67-
$this->assertSame('1', $db->getLastInsertID());
67+
$this->assertSame('1', $db->getLastInsertId());
6868

6969
$command->setSQL(
7070
<<<SQL
@@ -77,7 +77,7 @@ public function testGetLastInsertID(): void
7777
* these rows was 3, and it is this value that is returned by LAST_INSERT_ID() for the following SELECT
7878
* statement.
7979
*/
80-
$this->assertSame('3', $db->getLastInsertID());
80+
$this->assertSame('3', $db->getLastInsertId());
8181

8282
$command->setSQL(
8383
<<<SQL
@@ -90,7 +90,7 @@ public function testGetLastInsertID(): void
9090
* value (or 0 is returned if the connection has not yet performed a successful INSERT) and, for
9191
* non-transactional tables, the AUTO_INCREMENT counter is not incremented.
9292
*/
93-
$this->assertSame('0', $db->getLastInsertID());
93+
$this->assertSame('0', $db->getLastInsertId());
9494

9595
$db->close();
9696
}

0 commit comments

Comments
 (0)