Skip to content

Commit

Permalink
fixed wrong checking event for patrol participants
Browse files Browse the repository at this point in the history
(cherry picked from commit 826abb8)
  • Loading branch information
Lung committed May 23, 2024
1 parent 4f94049 commit 48b7944
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/Participant/ParticipantRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,14 @@ public function findOneByEntryCode(string $entryCode): ?Participant

public function findParticipantById(int $participantId, Event $event): ?Participant
{
$qb = $this->connection->select('participant.*')->from($this->getTable());

$qb->join('user')->as('u')->on('u.id = participant.user_id');

$qb->where('participant.id = %i', $participantId);
$qb->where('u.event_id = %i', $event->id);

/** @var ?Row $row */
$row = $qb->fetch();
if ($row === null) {
$participant = $this->findOneBy(['id' => $participantId]);
if ($participant === null) {
return null;
}

/** @var Participant $participant */
$participant = $this->createEntity($row);
if ($participant->getUserButNotNull()->event->id !== $event->id) {
return null;
}

return $participant;
}
Expand Down

0 comments on commit 48b7944

Please sign in to comment.