Files
solidtime/app/Service/Import/Importers/ReportDto.php
Constantin Graf a166f8ef44 Skip time entries that already exist when importing
Re-importing the same data duplicated all time entries, because only
clients, projects, tasks, tags and users were matched with existing
records. Time entries are now matched by member, start, end, project,
task and description. Matches are counted, so identical time entries
within one import are still kept.

Fixes #894
2026-12-04 16:02:06 +01:00

88 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Service\Import\Importers;
class ReportDto
{
public int $clientsCreated;
public int $projectsCreated;
public int $tasksCreated;
public int $timeEntriesCreated;
public int $timeEntriesSkipped;
public int $tagsCreated;
public int $usersCreated;
public function __construct(int $clientsCreated, int $projectsCreated, int $tasksCreated, int $timeEntriesCreated, int $timeEntriesSkipped, int $tagsCreated, int $usersCreated)
{
$this->clientsCreated = $clientsCreated;
$this->projectsCreated = $projectsCreated;
$this->tasksCreated = $tasksCreated;
$this->timeEntriesCreated = $timeEntriesCreated;
$this->timeEntriesSkipped = $timeEntriesSkipped;
$this->tagsCreated = $tagsCreated;
$this->usersCreated = $usersCreated;
}
public function getTotalCreated(): int
{
return $this->clientsCreated + $this->projectsCreated + $this->tasksCreated +
$this->timeEntriesCreated + $this->tagsCreated + $this->usersCreated;
}
/**
* @return array{
* clients: array{
* created: int,
* },
* projects: array{
* created: int,
* },
* tasks: array{
* created: int,
* },
* time_entries: array{
* created: int,
* skipped: int,
* },
* tags: array{
* created: int,
* },
* users: array{
* created: int,
* }
* }
*/
public function toArray(): array
{
return [
'clients' => [
'created' => $this->clientsCreated,
],
'projects' => [
'created' => $this->projectsCreated,
],
'tasks' => [
'created' => $this->tasksCreated,
],
'time_entries' => [
'created' => $this->timeEntriesCreated,
'skipped' => $this->timeEntriesSkipped,
],
'tags' => [
'created' => $this->tagsCreated,
],
'users' => [
'created' => $this->usersCreated,
],
];
}
}