Private
Public Access
chg: pkg: upgrade the doctrine related back-end pkgs to the latest available version #7
This commit is contained in:
@@ -269,7 +269,7 @@ class PlayedGameRepository extends ServiceEntityRepository
|
||||
COALESCE(SUM(CASE WHEN g.red_id = :uid THEN g.red_points ELSE g.blue_points END), 0) AS total_pts
|
||||
FROM played_game g
|
||||
WHERE (g.red_id = :uid OR g.blue_id = :uid)',
|
||||
['uid' => $user->getId()],
|
||||
['uid' => $user->id],
|
||||
)->fetchAssociative();
|
||||
|
||||
return (int) ($result['total_pts'] ?? 0);
|
||||
@@ -289,7 +289,7 @@ class PlayedGameRepository extends ServiceEntityRepository
|
||||
(g.red_id = :uid AND g.red_points IS NOT NULL)
|
||||
OR (g.blue_id = :uid AND g.blue_points IS NOT NULL)
|
||||
)',
|
||||
['uid' => $user->getId()],
|
||||
['uid' => $user->id],
|
||||
)->fetchAssociative();
|
||||
|
||||
if (!$result || (int) $result['total_games'] === 0) {
|
||||
@@ -306,7 +306,7 @@ class PlayedGameRepository extends ServiceEntityRepository
|
||||
*/
|
||||
public function findBonusStatsForUser(User $user): array
|
||||
{
|
||||
$userId = $user->getId();
|
||||
$userId = $user->id;
|
||||
$qb = $this->createQueryBuilder('g');
|
||||
$qb->where($qb->expr()->orX(
|
||||
$qb->expr()->eq('g.red', ':u'),
|
||||
@@ -323,10 +323,10 @@ class PlayedGameRepository extends ServiceEntityRepository
|
||||
$gameCount = 0;
|
||||
|
||||
foreach ($games as $game) {
|
||||
$isRed = $game->getRed()?->getId() === $userId;
|
||||
$totalBonusPoints += (float) (($isRed ? $game->getRedBonusPoints() : $game->getBlueBonusPoints()) ?? 0.0);
|
||||
$isRed = $game->red?->id === $userId;
|
||||
$totalBonusPoints += (float) (($isRed ? $game->redBonusPoints : $game->blueBonusPoints) ?? 0.0);
|
||||
|
||||
$stats = ($isRed ? $game->getRedBonusStats() : $game->getBlueBonusStats()) ?? [];
|
||||
$stats = ($isRed ? $game->redBonusStats : $game->blueBonusStats) ?? [];
|
||||
$bestChain = max($bestChain, (int) ($stats['chainBest'] ?? 0));
|
||||
$totalBlindHits += (int) ($stats['blindHits'] ?? 0);
|
||||
$totalEdgeMines += (int) ($stats['edgeMines'] ?? 0);
|
||||
|
||||
@@ -42,18 +42,19 @@ class StepRepository extends ServiceEntityRepository
|
||||
public function findMostRecent(PlayedGame $playedGame): ?Step
|
||||
{
|
||||
try {
|
||||
return $this->createQueryBuilder('s')
|
||||
->andWhere('s.playedGame = :game')
|
||||
->setParameter('game', $playedGame)
|
||||
->orderBy('s.created', 'DESC')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
return $this
|
||||
->createQueryBuilder('s')
|
||||
->andWhere('s.playedGame = :game')
|
||||
->setParameter('game', $playedGame)
|
||||
->orderBy('s.created', 'DESC')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
} catch (NonUniqueResultException $e) {
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
'Expected at most one result for the most recent step of game ID %d, but got multiple.',
|
||||
$playedGame->getId(),
|
||||
$playedGame->id,
|
||||
),
|
||||
0,
|
||||
$e,
|
||||
@@ -64,15 +65,16 @@ class StepRepository extends ServiceEntityRepository
|
||||
public function findMostRecentForPlayer(PlayedGame $playedGame, string $player): ?Step
|
||||
{
|
||||
try {
|
||||
return $this->createQueryBuilder('s')
|
||||
->andWhere('s.playedGame = :game')
|
||||
->andWhere('s.player = :player')
|
||||
->setParameter('game', $playedGame)
|
||||
->setParameter('player', $player)
|
||||
->orderBy('s.created', 'DESC')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
return $this
|
||||
->createQueryBuilder('s')
|
||||
->andWhere('s.playedGame = :game')
|
||||
->andWhere('s.player = :player')
|
||||
->setParameter('game', $playedGame)
|
||||
->setParameter('player', $player)
|
||||
->orderBy('s.created', 'DESC')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
} catch (NonUniqueResultException $e) {
|
||||
throw new RuntimeException(
|
||||
'Expected at most one result for the most recent step of player "%s" in game ID %d, but got multiple.',
|
||||
|
||||
@@ -93,7 +93,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
|
||||
}
|
||||
|
||||
$user->setPassword($newHashedPassword);
|
||||
$user->password = $newHashedPassword;
|
||||
$this->getEntityManager()->persist($user);
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,15 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* Class WebAuthnCredentialRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 12.
|
||||
*
|
||||
* @extends ServiceEntityRepository<WebAuthnCredential>
|
||||
*
|
||||
* @method WebAuthnCredential|null find($id, $lockMode = null, $lockVersion = null)
|
||||
|
||||
Reference in New Issue
Block a user