mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
fix(snowflake): Fix generateId() call for SnowflakeEntity
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
0cdd19271d
commit
fe393c5dbf
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