mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Merge pull request #57410 from nextcloud/bugfix/noid/fix-generate-id
fix(snowflake): Fix generateId() call for SnowflakeEntity
This commit is contained in:
commit
15b45975e2
1 changed files with 6 additions and 5 deletions
|
|
@ -95,6 +95,11 @@ abstract class QBMapper {
|
|||
* @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();
|
||||
|
|
@ -115,11 +120,7 @@ abstract class QBMapper {
|
|||
$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());
|
||||
|
|
|
|||
Loading…
Reference in a new issue