Skip to content

Commit

Permalink
fixed IST fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtomklima committed Apr 12, 2024
1 parent 3139a27 commit 2a64ff8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/Import/ImportSrs.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public function importIst(UploadedFile $istsDataFile, Event $event): void
fn (string $value): string => substr($value, 1, -1),
$istData,
);
$dbIst = $this->istRepository->findIst($istData['E-mail'], $event);
if ($dbIst instanceof Ist) {
if ($this->istRepository->isIstExisting($istData['E-mail'], $event)) {
$existingCount++;
continue;
}
Expand Down
10 changes: 4 additions & 6 deletions src/Participant/Ist/IstRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@
*/
class IstRepository extends Repository
{
public function findIst(string $email, Event $event): ?Ist
public function isIstExisting(string $email, Event $event): bool
{
$qb = $this->createFluent();

$qb->where('participant.email = %s', $email);
$qb->join('user')->as('u')->on('u.id = participant.user_id');
$qb->where('u.event_id = %i', $event->id);

/** @var Row $row */
/** @var ?Row $row */
$row = $qb->fetch();
/** @var ?Ist $ist */
$ist = $this->createEntity($row);

return $ist;
}
return $row instanceof Row;
}
}

0 comments on commit 2a64ff8

Please sign in to comment.