Skip to content
Merged
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions lib/Store/Local/BaseEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAVC\Store\Local;

use OCP\AppFramework\Db\Entity;

/**
* Base entity for chronicled data store entities.
*
* Declares the accessors shared by all entities handled by {@see BaseStore}
* so that they resolve as defined magic methods when an entity is referenced
* through this base type.
*
* @method getUid(): string
* @method setUid(string $uid): void
* @method getSid(): int
* @method setSid(int $sid): void
* @method getCid(): int
* @method setCid(int $cid): void
* @method getUuid(): string
* @method setUuid(string $uuid): void
*/
abstract class BaseEntity extends Entity {
}
24 changes: 12 additions & 12 deletions lib/Store/Local/BaseStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,11 @@ public function entityFresh(): Entity {
/**
* create a entity entry in the data store
*
* @param Entity $entity
* @param BaseEntity $entity
*
* @return Entity
* @return BaseEntity
*/
public function entityCreate(Entity $entity): Entity {
public function entityCreate(BaseEntity $entity): BaseEntity {

// construct data store command
$cmd = $this->_Store->getQueryBuilder();
Expand Down Expand Up @@ -649,11 +649,11 @@ public function entityCreate(Entity $entity): Entity {
/**
* modify a entity entry in the data store
*
* @param Entity $entity
* @param BaseEntity $entity
*
* @return Entity
* @return BaseEntity
*/
public function entityModify(Entity $entity): Entity {
public function entityModify(BaseEntity $entity): BaseEntity {

// construct data store command
$cmd = $this->_Store->getQueryBuilder();
Expand Down Expand Up @@ -685,11 +685,11 @@ public function entityModify(Entity $entity): Entity {
/**
* delete a entity from the data store
*
* @param Entity $entity
* @param BaseEntity $entity
*
* @return Entity
* @return BaseEntity
*/
public function entityDelete(Entity $entity): Entity {
public function entityDelete(BaseEntity $entity): BaseEntity {

// construct data store command
$cmd = $this->_Store->getQueryBuilder();
Expand Down Expand Up @@ -776,10 +776,10 @@ public function entityDeleteByCollection(int $cid): mixed {
*
* @param string $uid user id
* @param int $sid service id
* @param string $cid collection id
* @param string $eid entity id
* @param int $cid collection id
* @param int $eid entity id
* @param string $euuid entity uuid
* @param string $operation operation type (1 - Created, 2 - Modified, 3 - Deleted)
* @param int $operation operation type (1 - Created, 2 - Modified, 3 - Deleted)
*
* @return string
*/
Expand Down
13 changes: 1 addition & 12 deletions lib/Store/Local/ContactEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,7 @@

namespace OCA\DAVC\Store\Local;

use OCP\AppFramework\Db\Entity;

/**
* @method getId(): int
* @method getUid(): string
* @method setUid(string $uid): void
* @method getSid(): string
* @method setSid(int $sid): void
* @method getCid(): string
* @method setCid(int $cid): void
* @method getUuid(): string
* @method setUuid(string $uuid): void
* @method getSignature(): string
* @method setSignature(string $signature): void
* @method getCcid(): string
Expand All @@ -34,7 +23,7 @@
* @method getLabel(): string
* @method setLabel(string $label): void
*/
class ContactEntity extends Entity {
class ContactEntity extends BaseEntity {
protected ?string $uid = null;
protected ?int $sid = null;
protected ?int $cid = null;
Expand Down
13 changes: 1 addition & 12 deletions lib/Store/Local/EventEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,7 @@

namespace OCA\DAVC\Store\Local;

use OCP\AppFramework\Db\Entity;

/**
* @method getId(): int
* @method getUid(): string
* @method setUid(string $uid): void
* @method getSid(): string
* @method setSid(int $sid): void
* @method getCid(): string
* @method setCid(int $cid): void
* @method getUuid(): string
* @method setUuid(string $uuid): void
* @method getSignature(): string
* @method setSignature(string $signature): void
* @method getCcid(): string
Expand All @@ -40,7 +29,7 @@
* @method getEndson(): int
* @method setEndson(int $endson): void
*/
class EventEntity extends Entity {
class EventEntity extends BaseEntity {
protected ?string $uid = null;
protected ?int $sid = null;
protected ?int $cid = null;
Expand Down
Loading