mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 06:08:46 -04:00
refactor(entity): Don't type id
Some apps overwrite this and this breaks them. Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
parent
6fd76bfa0e
commit
81a21fb718
2 changed files with 4 additions and 2 deletions
|
|
@ -19,7 +19,8 @@ use function substr;
|
|||
* @psalm-consistent-constructor
|
||||
*/
|
||||
abstract class Entity {
|
||||
public int|string|null $id = null;
|
||||
/** @var int $id */
|
||||
public $id;
|
||||
private array $_updatedFields = [];
|
||||
/** @psalm-param $_fieldTypes array<string, Types::*> */
|
||||
protected array $_fieldTypes = ['id' => 'integer'];
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ abstract class SnowflakeAwareEntity extends Entity {
|
|||
*/
|
||||
public function generateId(): void {
|
||||
if ($this->id === null) {
|
||||
/** @psalm-suppress InvalidPropertyAssignmentValue */
|
||||
$this->id = Server::get(ISnowflakeGenerator::class)->nextId();
|
||||
$this->markFieldUpdated('id');
|
||||
}
|
||||
|
|
@ -50,7 +51,7 @@ abstract class SnowflakeAwareEntity extends Entity {
|
|||
}
|
||||
|
||||
if ($this->snowflake === null) {
|
||||
$this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->id);
|
||||
$this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->getId());
|
||||
}
|
||||
|
||||
return $this->snowflake;
|
||||
|
|
|
|||
Loading…
Reference in a new issue