Skip to content

Commit d371f41

Browse files
committed
fixup! feat(snowflake): extend Entity class to support snowflakes
1 parent efc42f2 commit d371f41

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/public/AppFramework/Db/SnowflakeAwareEntity.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
/**
5+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
6+
* SPDX-License-Identifier: AGPL-3.0-only
7+
*/
38
namespace OCP\AppFramework\Db;
49

510
use OCP\AppFramework\Attribute\Consumable;
@@ -19,6 +24,11 @@ abstract class SnowflakeAwareEntity extends Entity {
1924
/** @var array<string, \OCP\DB\Types::*> */
2025
private array $_fieldTypes = ['id' => 'string'];
2126

27+
/**
28+
* Automatically creates a snowflake ID
29+
*
30+
* @return void
31+
*/
2232
#[\Override]
2333
public function setId(): void {
2434
if (empty($this->id)) {
@@ -27,6 +37,9 @@ public function setId(): void {
2737
}
2838
}
2939

40+
/**
41+
* @psalm-suppress InvalidReturnStatement
42+
*/
3043
#[\Override]
3144
public function getId(): string {
3245
return $this->id;

0 commit comments

Comments
 (0)