Skip to content
Merged
Changes from all commits
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
11 changes: 6 additions & 5 deletions lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public function delete(Entity $entity): Entity {
* @since 14.0.0
*/
public function insert(Entity $entity): Entity {
if ($entity instanceof SnowflakeAwareEntity) {
/** @psalm-suppress DocblockTypeContradiction */
$entity->generateId();
}

// get updated fields to save, fields have to be set using a setter to
// be saved
$properties = $entity->getUpdatedFields();
Expand All @@ -115,11 +120,7 @@ public function insert(Entity $entity): Entity {
$qb->setValue($column, $qb->createNamedParameter($value, $type));
}

if ($entity instanceof SnowflakeAwareEntity) {
/** @psalm-suppress DocblockTypeContradiction */
$entity->generateId();
$qb->executeStatement();
} elseif ($entity->id === null) {
if ($entity->id === null) {
$qb->executeStatement();
// When autoincrement is used id is always an int
$entity->setId($qb->getLastInsertId());
Expand Down
Loading