new: usr: registered users have avatars next to the timer #4
This commit is contained in:
@@ -18,6 +18,7 @@ use App\Entity\User;
|
||||
use App\Interfaces\TopicManagerInterface;
|
||||
use App\Repository\PlayedGameRepository;
|
||||
use App\Repository\UserRepository;
|
||||
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
||||
use DateTimeInterface;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -47,6 +48,7 @@ readonly class TopicManager implements TopicManagerInterface
|
||||
private LoggerInterface $logger,
|
||||
private PlayedGameRepository $playedGameRepository,
|
||||
private UserRepository $userRepository,
|
||||
private CacheManager $cacheManager,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -516,11 +518,20 @@ readonly class TopicManager implements TopicManagerInterface
|
||||
|
||||
private function getUserCollection(PlayedGame $playedGame): array
|
||||
{
|
||||
$redUser = $playedGame->getRed();
|
||||
$blueUser = $playedGame->getBlue();
|
||||
|
||||
return [
|
||||
'red' => null !== $playedGame->getRed() ? $playedGame->getRed()->getUsername() : '',
|
||||
'blue' => null !== $playedGame->getBlue() ? $playedGame->getBlue()->getUsername() : '',
|
||||
'redAnon' => null !== $playedGame->getRedAnon() ? $playedGame->getRedAnon()->getUserName() : '',
|
||||
'blueAnon' => null !== $playedGame->getBlueAnon() ? $playedGame->getBlueAnon()->getUserName() : '',
|
||||
'red' => null !== $redUser ? $redUser->getUsername() : '',
|
||||
'blue' => null !== $blueUser ? $blueUser->getUsername() : '',
|
||||
'redAnon' => null !== $playedGame->getRedAnon() ? $playedGame->getRedAnon()->getUserName() : '',
|
||||
'blueAnon' => null !== $playedGame->getBlueAnon() ? $playedGame->getBlueAnon()->getUserName() : '',
|
||||
'redAvatar' => null !== $redUser && null !== $redUser->getAvatarPath()
|
||||
? $this->cacheManager->generateUrl($redUser->getAvatarPath(), 'avatar_thumb')
|
||||
: null,
|
||||
'blueAvatar' => null !== $blueUser && null !== $blueUser->getAvatarPath()
|
||||
? $this->cacheManager->generateUrl($blueUser->getAvatarPath(), 'avatar_thumb')
|
||||
: null,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user