Skip to content

Commit

Permalink
Added synchronization of epics
Browse files Browse the repository at this point in the history
  • Loading branch information
jeppekroghitk committed Jan 2, 2025
1 parent 1d64016 commit 0eab1b9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Service/DataSynchronizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use App\Repository\AccountRepository;
use App\Repository\ClientRepository;
use App\Repository\DataProviderRepository;
use App\Repository\EpicRepository;
use App\Repository\InvoiceRepository;
use App\Repository\IssueRepository;
use App\Repository\ProjectRepository;
Expand Down Expand Up @@ -45,6 +46,7 @@ public function __construct(
private readonly DataProviderService $dataProviderService,
private readonly DataProviderRepository $dataProviderRepository,
private readonly WorkerRepository $workerRepository,
private readonly EpicRepository $epicRepository,
) {
}

Expand Down Expand Up @@ -271,6 +273,26 @@ public function syncIssuesForProject(int $projectId, ?callable $progressCallback
}
}

$epicArray = explode(',', $issueDatum->epicName);

foreach ($epicArray as $epicTitle) {
if (empty($epicTitle)) {
continue;
}
$epic = $this->epicRepository->findOneBy([
'title' => $epicTitle,
]);

if (!$epic) {
$epic = new Epic();

Check failure on line 287 in src/Service/DataSynchronizationService.php

View workflow job for this annotation

GitHub Actions / Psalm static analysis (8.1)

UndefinedClass

src/Service/DataSynchronizationService.php:287:37: UndefinedClass: Class, interface or enum named App\Service\Epic does not exist (see https://psalm.dev/019)
$epic->setTitle($epicTitle);

Check failure on line 288 in src/Service/DataSynchronizationService.php

View workflow job for this annotation

GitHub Actions / Psalm static analysis (8.1)

UndefinedClass

src/Service/DataSynchronizationService.php:288:25: UndefinedClass: Class, interface or enum named App\Service\Epic does not exist (see https://psalm.dev/019)
$this->entityManager->persist($epic);
$this->entityManager->flush();
}

$issue->addEpic($epic);

Check failure on line 293 in src/Service/DataSynchronizationService.php

View workflow job for this annotation

GitHub Actions / Psalm static analysis (8.1)

PossiblyInvalidArgument

src/Service/DataSynchronizationService.php:293:37: PossiblyInvalidArgument: Argument 1 of App\Entity\Issue::addEpic expects App\Entity\Epic, but possibly different type App\Entity\Epic|App\Service\Epic provided (see https://psalm.dev/092)
}

if (null !== $progressCallback) {
$progressCallback($issuesProcessed, $total);
++$issuesProcessed;
Expand Down

0 comments on commit 0eab1b9

Please sign in to comment.