Skip to content

Commit

Permalink
Merge pull request #13086 from nextcloud/bugfix/dont-query-when-id-no…
Browse files Browse the repository at this point in the history
…t-null

Fetch lastInsertId only when id null
  • Loading branch information
rullzer committed Dec 27, 2018
2 parents 1c3f468 + 8a952b7 commit bb3a7ad
Showing 1 changed file with 3 additions and 1 deletion.
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->id === null) {
$entity->setId((int)$qb->getLastInsertId());
}

return $entity;
}
Expand Down

0 comments on commit bb3a7ad

Please sign in to comment.