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 <mail@danielkesselberg.de>
This commit is contained in:
parent
027f69df3f
commit
21b80a89b0
1 changed files with 3 additions and 1 deletions
|
@ -119,7 +119,9 @@ abstract class QBMapper {
|
|||
|
||||
$qb->execute();
|
||||
|
||||
$entity->setId((int) $qb->getLastInsertId());
|
||||
if($entity->getId() === null) {
|
||||
$entity->setId((int)$qb->getLastInsertId());
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue