Skip to content

Commit

Permalink
update CHANGELOG.md, EEntity.php and FileDuplicate.php
Browse files Browse the repository at this point in the history
  • Loading branch information
eldertek committed Aug 6, 2024
1 parent 880c7d0 commit 1cf1aa9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 1.2.5 - 2024-08-06
### Changed
- Confirm box to prevent deleting all files of a duplicate
- Userid is now automatically set when inserting or updating an entity

## 1.2.4 - 2024-07-24
### Added
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/EEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function setter(string $name, array $args): void
}

/**
* Method-Wrapper setter of the Entity to support new types (date, json)
* Method-Wrapper getter of the Entity to support new types (date, json)
* @param string $name
* @return mixed
*/
Expand Down Expand Up @@ -207,4 +207,4 @@ public function setKeepAsPrimary($keepAsPrimary)
{
$this->keepAsPrimary = $keepAsPrimary;
}
}
}
33 changes: 26 additions & 7 deletions lib/Db/FileDuplicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
class FileDuplicate extends EEntity
{

/** @var string */
protected $type;
/** @var string|null */
Expand All @@ -20,7 +19,8 @@ class FileDuplicate extends EEntity
protected $files = [];
/** @var bool */
protected $acknowledged = false;

/** @var int|null */
protected $userId;

public function __construct(?string $hash = null, string $type = 'file_hash')
{
Expand All @@ -36,25 +36,25 @@ public function __construct(?string $hash = null, string $type = 'file_hash')
* @param int $id
* @param string|FileInfo $value
*/
public function addDuplicate(int $id, $value):void
public function addDuplicate(int $id, $value): void
{
$this->files[$id] = $value;
}

public function removeDuplicate(int $id):void
public function removeDuplicate(int $id): void
{
unset($this->files[$id]);
}

public function clear():void
public function clear(): void
{
$this->files = [];
}

/**
* @return array<string|FileInfo>
*/
public function getFiles():array
public function getFiles(): array
{
return $this->files;
}
Expand Down Expand Up @@ -95,5 +95,24 @@ public function setAcknowledged(bool $acknowledged): void
{
$this->acknowledged = $acknowledged;
}


/**
* Get the value of the userId property.
*
* @return int|null
*/
public function getUserId(): ?int
{
return $this->userId;
}

/**
* Set the value of the userId property.
*
* @param int|null $userId
*/
public function setUserId(?int $userId): void
{
$this->userId = $userId;
}
}

0 comments on commit 1cf1aa9

Please sign in to comment.