From cd93a26c2ca19fab7a209c8877e8ff500eab7704 Mon Sep 17 00:00:00 2001 From: Lang <7system7@gmail.com> Date: Mon, 20 Apr 2026 10:50:58 +0200 Subject: [PATCH] fix: usr: the username was not recognized properly #7 --- src/Repository/PlayedGameRepository.php | 14 ++++---------- src/Util/TopicManager.php | 8 +++++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Repository/PlayedGameRepository.php b/src/Repository/PlayedGameRepository.php index 6665c94..26efdfe 100644 --- a/src/Repository/PlayedGameRepository.php +++ b/src/Repository/PlayedGameRepository.php @@ -407,15 +407,9 @@ class PlayedGameRepository extends ServiceEntityRepository ->leftJoin('g.blue', 'bb') ->leftJoin('g.redAnon', 'ra') ->leftJoin('g.blueAnon', 'ba') - ->where($qb->expr()->andX( - $qb->expr()->orX( - $qb->expr()->eq('g.red', ':u'), - $qb->expr()->eq('g.blue', ':u'), - ), - $qb->expr()->orX( - $qb->expr()->isNotNull('g.redPoints'), - $qb->expr()->isNotNull('g.resign'), - ), + ->where($qb->expr()->orX( + $qb->expr()->eq('g.red', ':u'), + $qb->expr()->eq('g.blue', ':u'), )) ->setParameter('u', $user) ->orderBy('g.updated', 'DESC') @@ -457,4 +451,4 @@ class PlayedGameRepository extends ServiceEntityRepository ->getQuery() ->getResult(); } -} \ No newline at end of file +} diff --git a/src/Util/TopicManager.php b/src/Util/TopicManager.php index 82531ba..d650931 100644 --- a/src/Util/TopicManager.php +++ b/src/Util/TopicManager.php @@ -26,6 +26,7 @@ use JsonException; use Liip\ImagineBundle\Imagine\Cache\CacheManager; use Psr\Log\LoggerInterface; use RuntimeException; +use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Mercure\HubInterface; use Symfony\Component\Mercure\Update; @@ -50,6 +51,7 @@ readonly class TopicManager implements TopicManagerInterface private PlayedGameRepository $playedGameRepository, private UserRepository $userRepository, private RequestStack $requestStack, + private Security $security, ) { } @@ -640,7 +642,7 @@ readonly class TopicManager implements TopicManagerInterface { $playedGame = $this->getPlayedGame($gameAssoc); - null !== $this->requestStack->getCurrentRequest()->getUser() + null !== $this->security->getUser() ? $this->saveRegisteredUser($userName, $count, $playedGame) : $this->saveAnonUser($userName, $count, $playedGame); @@ -664,6 +666,8 @@ readonly class TopicManager implements TopicManagerInterface ? $playedGame->red = $user : $playedGame->blue = $user; } + + $this->em->persist($playedGame); } catch (Exception $e) { $this->logger->error($e->getMessage()); } @@ -689,6 +693,8 @@ readonly class TopicManager implements TopicManagerInterface ? $playedGame->redAnon = $anon : $playedGame->blueAnon = $anon; } + + $this->em->persist($playedGame); } catch (Exception $e) { $this->logger->error($e->getMessage()); }