Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Fetch lastInsertId only when id null
When id column has no autoincrement flag query for lastInsertId fails
on postgres because no value has been generated. Call lastInsertId only
if id is null.

Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb authored and rullzer committed Dec 24, 2018
commit 21b80a89b0d34318c257cc93eba9333228f1854e
4 changes: 3 additions & 1 deletion lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public function insert(Entity $entity): Entity {

$qb->execute();

$entity->setId((int) $qb->getLastInsertId());
if($entity->getId() === null) {
$entity->setId((int)$qb->getLastInsertId());
}

return $entity;
}
Expand Down