for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the Valkyrja Framework package.
*
* (c) Melech Mizrachi <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Valkyrja\Orm;
use Valkyrja\Orm\Exception\RuntimeException;
use function is_string;
/**
* Class PgsqlManager.
* @author Melech Mizrachi
class PgsqlManager extends PdoManager
{
* @inheritDoc
public function lastInsertId(string|null $table = null, string|null $idField = null): string
$name = null;
if ($table !== null && $idField !== null) {
$name = "{$table}_{$idField}_seq";
}
/** @var non-empty-string|false $lastInsertId */
$lastInsertId = $this->pdo->lastInsertId($name);
return is_string($lastInsertId)
is_string($lastInsertId)
true
? $lastInsertId
: throw new RuntimeException('No last insert id found');