Use 'insert ... returning' instead of 'Db::GetLastInsertedId()'

This commit is contained in:
Alex Cabal 2025-03-10 11:04:20 -05:00
parent 4446b6d161
commit 5066252355
12 changed files with 44 additions and 57 deletions

View file

@ -347,7 +347,7 @@ final class Project{
throw new Exceptions\ProjectExistsException();
}
Db::Query('
$this->ProjectId = Db::QueryInt('
INSERT into Projects
(
EbookId,
@ -384,10 +384,9 @@ final class Project{
?,
?
)
returning ProjectId
', [$this->EbookId, $this->Status, $this->ProducerName, $this->ProducerEmail, $this->DiscussionUrl, $this->VcsUrl, NOW, NOW, $this->Started, $this->Ended, $this->ManagerUserId, $this->ReviewerUserId, $this->LastCommitTimestamp, $this->LastDiscussionTimestamp, $this->IsStatusAutomaticallyUpdated]);
$this->ProjectId = Db::GetLastInsertedId();
// Notify the manager and reviewer.
if($this->Status == Enums\ProjectStatusType::InProgress){
// The manager is also the reviewer, just send one email.