Private
Public Access
1
0

chg: pkg: upgrade the doctrine related back-end pkgs to the latest available version #7

This commit is contained in:
2026-04-20 09:05:36 +02:00
parent 5f856e4d70
commit 175581cdd5
30 changed files with 456 additions and 1015 deletions

View File

@@ -78,22 +78,22 @@ class ProfileController extends AbstractController
$since = new DateTime('first day of -5 months midnight');
$recentGames = $this->repo->findFinishedForUserSince($user, $since);
$userId = $user->getId();
$userId = $user->id;
foreach ($recentGames as $game) {
if (!$game->getUpdated()) {
if (!$game->updated) {
continue;
}
$month = $game->getUpdated()->format('Y-m');
$month = $game->updated->format('Y-m');
if (!isset($monthlyData[$month])) {
continue;
}
$isRed = $game->getRed()?->getId() === $userId;
$myPts = $isRed ? $game->getRedPoints() : $game->getBluePoints();
$oppPts = $isRed ? $game->getBluePoints() : $game->getRedPoints();
$resign = $game->getResign();
$isRed = $game->red?->id === $userId;
$myPts = $isRed ? $game->redPoints : $game->bluePoints;
$oppPts = $isRed ? $game->bluePoints : $game->redPoints;
$resign = $game->resign;
$myColor = $isRed ? 'red' : 'blue';
$oppColor = $isRed ? 'blue' : 'red';
@@ -131,12 +131,12 @@ class ProfileController extends AbstractController
],
'recent' => ($recent = $this->repo->findRecentFinishedForUser($user, 30)),
'gamesData' => array_map(function (PlayedGame $game) use ($userId, $cacheManager): array {
$isRed = $game->getRed()?->getId() === $userId;
$resign = $game->getResign();
$isRed = $game->red?->id === $userId;
$resign = $game->resign;
$myColor = $isRed ? 'red' : 'blue';
$oppColor = $isRed ? 'blue' : 'red';
$myPts = $isRed ? $game->getRedPoints() : $game->getBluePoints();
$oppPts = $isRed ? $game->getBluePoints() : $game->getRedPoints();
$myPts = $isRed ? $game->redPoints : $game->bluePoints;
$oppPts = $isRed ? $game->bluePoints : $game->redPoints;
$result = 'draw';
if ($resign === $myColor) $result = 'loss';
@@ -146,33 +146,33 @@ class ProfileController extends AbstractController
elseif ($myPts < $oppPts) $result = 'loss';
}
$redAvatarPath = $game->getRed()?->getAvatarPath();
$blueAvatarPath = $game->getBlue()?->getAvatarPath();
$redAvatarPath = $game->red?->avatarPath;
$blueAvatarPath = $game->blue?->avatarPath;
return [
'id' => $game->getId(),
'uuid' => $game->getUuid()?->toRfc4122(),
'id' => $game->id,
'uuid' => $game->uuid?->toRfc4122(),
'redName' =>
$game->getRed()?->getUsername() ?? $game->getRedAnon()?->getUserName() ?? 'Guest',
$game->red?->getUsername() ?? $game->redAnon?->userName ?? 'Guest',
'blueName' =>
$game->getBlue()?->getUsername() ?? $game->getBlueAnon()?->getUserName() ?? 'Guest',
$game->blue?->getUsername() ?? $game->blueAnon?->userName ?? 'Guest',
'redAvatar' => $redAvatarPath ? $cacheManager->generateUrl($redAvatarPath, 'avatar_thumb') : null,
'blueAvatar' => $blueAvatarPath ? $cacheManager->generateUrl($blueAvatarPath, 'avatar_thumb') : null,
'redPoints' => $game->getRedPoints(),
'bluePoints' => $game->getBluePoints(),
'redExplodedBomb' => $game->getRedExplodedBomb(),
'blueExplodedBomb' => $game->getBlueExplodedBomb(),
'redPoints' => $game->redPoints,
'bluePoints' => $game->bluePoints,
'redExplodedBomb' => $game->redExplodedBomb,
'blueExplodedBomb' => $game->blueExplodedBomb,
'resign' => $resign,
'created' => $game->getCreated()?->format('Y-m-d H:i'),
'date' => $game->getUpdated()?->format('Y-m-d H:i'),
'created' => $game->created?->format('Y-m-d H:i'),
'date' => $game->updated?->format('Y-m-d H:i'),
'isRed' => $isRed,
'result' => $result,
'myPoints' => $myPts,
'oppPoints' => $oppPts,
'redBonusPoints' => $game->getRedBonusPoints() ?? 0,
'blueBonusPoints' => $game->getBlueBonusPoints() ?? 0,
'redBonusStats' => $game->getRedBonusStats() ?? [],
'blueBonusStats' => $game->getBlueBonusStats() ?? [],
'redBonusPoints' => $game->redBonusPoints ?? 0,
'blueBonusPoints' => $game->blueBonusPoints ?? 0,
'redBonusStats' => $game->redBonusStats ?? [],
'blueBonusStats' => $game->blueBonusStats ?? [],
];
}, $recent),
'chartData' => [
@@ -202,10 +202,10 @@ class ProfileController extends AbstractController
$mines = [];
$bonus = [];
foreach ($recent as $i => $game) {
$isRed = $game->getRed()?->getId() === $userId;
$isRed = $game->red?->id === $userId;
$labels[] = '#' . ($i + 1);
$mines[] = (int)($isRed ? $game->getRedPoints() : $game->getBluePoints());
$bonus[] = (float)($isRed ? $game->getRedBonusPoints() : $game->getBlueBonusPoints()) ?: 0;
$mines[] = (int)($isRed ? $game->redPoints : $game->bluePoints);
$bonus[] = (float)($isRed ? $game->redBonusPoints : $game->blueBonusPoints) ?: 0;
}
return ['labels' => $labels, 'mines' => $mines, 'bonus' => $bonus];
@@ -224,17 +224,17 @@ class ProfileController extends AbstractController
throw $this->createNotFoundException('Battle not found.');
}
$redName = $game->getRed()?->getUsername() ?? ($game->getRedAnon() !== null ? 'Anonymous' : 'Guest');
$blueName = $game->getBlue()?->getUsername() ?? ($game->getBlueAnon() !== null ? 'Anonymous' : 'Guest');
$redPts = $game->getRedPoints();
$bluePts = $game->getBluePoints();
$resign = $game->getResign();
$redAvatar = $game->getRed()?->getAvatarPath();
$blueAvatar = $game->getBlue()?->getAvatarPath();
$redBonusPoints = $game->getRedBonusPoints() ?? 0;
$blueBonusPoints = $game->getBlueBonusPoints() ?? 0;
$redBonusStats = $game->getRedBonusStats() ?? [];
$blueBonusStats = $game->getBlueBonusStats() ?? [];
$redName = $game->red?->getUsername() ?? ($game->redAnon !== null ? 'Anonymous' : 'Guest');
$blueName = $game->blue?->getUsername() ?? ($game->blueAnon !== null ? 'Anonymous' : 'Guest');
$redPts = $game->redPoints;
$bluePts = $game->bluePoints;
$resign = $game->resign;
$redAvatar = $game->red?->avatarPath;
$blueAvatar = $game->blue?->avatarPath;
$redBonusPoints = $game->redBonusPoints ?? 0;
$blueBonusPoints = $game->blueBonusPoints ?? 0;
$redBonusStats = $game->redBonusStats ?? [];
$blueBonusStats = $game->blueBonusStats ?? [];
if ($resign === 'red') {
$summary = "$redName resigned — $blueName wins";
@@ -321,7 +321,7 @@ class ProfileController extends AbstractController
$ext = $file->guessExtension() ?? 'jpg';
$newPath = sprintf('avatar/%s.%s', Uuid::v4()->toRfc4122(), $ext);
$oldPath = $user->getAvatarPath();
$oldPath = $user->avatarPath;
/** Remove old file and any cached thumbnails */
if ($oldPath) {
@@ -343,7 +343,7 @@ class ProfileController extends AbstractController
}
fclose($stream);
$user->setAvatarPath($newPath);
$user->avatarPath = $newPath;
$em->flush();
return $this->json([
@@ -360,18 +360,18 @@ class ProfileController extends AbstractController
$credentials = $this->webAuthnService->getCredentialsForUser($user);
$credentialsData = array_map(fn($cred) => [
'id' => $cred->getId(),
'credentialName' => $cred->getCredentialName(),
'createdAt' => $cred->getCreatedAt()?->format('Y-m-d H:i:s'),
'lastUsedAt' => $cred->getLastUsedAt()?->format('Y-m-d H:i:s'),
'isBackupEligible' => $cred->isBackupEligible(),
'isBackupAuthenticated' => $cred->isBackupAuthenticated(),
'id' => $cred->id,
'credentialName' => $cred->credentialName,
'createdAt' => $cred->createdAt?->format('Y-m-d H:i:s'),
'lastUsedAt' => $cred->lastUsedAt?->format('Y-m-d H:i:s'),
'isBackupEligible' => $cred->isBackupEligible,
'isBackupAuthenticated' => $cred->isBackupAuthenticated,
], $credentials);
return $this->render('Security/profile_security.html.twig', [
'credentials' => $credentialsData,
'isTotpEnabled' => $user->isTotpAuthenticationEnabled(),
'backupCodesCount' => count($user->getBackupCodes()),
'backupCodesCount' => count($user->backupCodes),
]);
}
}