|
|
|
|
@ -1234,11 +1234,11 @@ class QueryBuilder implements IQueryBuilder { |
|
|
|
|
* @return int |
|
|
|
|
* @throws \BadMethodCallException When being called before an insert query has been run. |
|
|
|
|
*/ |
|
|
|
|
public function getLastInsertId() { |
|
|
|
|
public function getLastInsertId(): int { |
|
|
|
|
if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) { |
|
|
|
|
// lastInsertId() needs the prefix but no quotes |
|
|
|
|
$table = $this->prefixTableName($this->lastInsertedTable); |
|
|
|
|
return (int) $this->connection->lastInsertId($table); |
|
|
|
|
return $this->connection->lastInsertId($table); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.'); |
|
|
|
|
|