mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-04 22:50:15 +02:00
Update composer.lock with dependency upgrades and improvements (#79)
* Update composer.lock with dependency upgrades and improvements Updated multiple dependencies in `composer.lock` to their latest versions, including upgrades for Doctrine, PHPUnit, Symfony components, and extended PostgreSQL support. * Fix sass compile
This commit is contained in:
@@ -27,6 +27,7 @@ final class BackofficeController extends AbstractController
|
||||
private readonly SeasonRepository $seasonRepository,
|
||||
private readonly Security $security,
|
||||
private readonly QuizSpreadsheetService $excel,
|
||||
private readonly EntityManagerInterface $em,
|
||||
) {}
|
||||
|
||||
#[Route('/backoffice/', name: 'tvdt_backoffice_index')]
|
||||
@@ -45,7 +46,7 @@ final class BackofficeController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/backoffice/season/add', name: 'tvdt_backoffice_season_add', priority: 10)]
|
||||
public function addSeason(Request $request, EntityManagerInterface $em): Response
|
||||
public function addSeason(Request $request): Response
|
||||
{
|
||||
$season = new Season();
|
||||
$form = $this->createForm(CreateSeasonFormType::class, $season);
|
||||
@@ -59,8 +60,8 @@ final class BackofficeController extends AbstractController
|
||||
$season->addOwner($user);
|
||||
$season->generateSeasonCode();
|
||||
|
||||
$em->persist($season);
|
||||
$em->flush();
|
||||
$this->em->persist($season);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('tvdt_backoffice_season', ['seasonCode' => $season->seasonCode]);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use Tvdt\Factory\EliminationFactory;
|
||||
|
||||
final class PrepareEliminationController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EliminationFactory $eliminationFactory) {}
|
||||
public function __construct(private readonly EliminationFactory $eliminationFactory, private readonly EntityManagerInterface $em) {}
|
||||
|
||||
#[Route(
|
||||
'/backoffice/season/{seasonCode:season}/quiz/{quiz}/elimination/prepare',
|
||||
@@ -37,11 +37,11 @@ final class PrepareEliminationController extends AbstractController
|
||||
name: 'tvdt_prepare_elimination_view',
|
||||
requirements: ['elimination' => Requirement::UUID],
|
||||
)]
|
||||
public function viewElimination(Elimination $elimination, Request $request, EntityManagerInterface $em): Response
|
||||
public function viewElimination(Elimination $elimination, Request $request): Response
|
||||
{
|
||||
if ('POST' === $request->getMethod()) {
|
||||
$elimination->updateFromInputBag($request->request);
|
||||
$em->flush();
|
||||
$this->em->flush();
|
||||
|
||||
if ($request->request->getBoolean('start')) {
|
||||
return $this->redirectToRoute('tvdt_elimination', ['elimination' => $elimination->id]);
|
||||
|
||||
@@ -35,6 +35,7 @@ class QuizController extends AbstractController
|
||||
private readonly QuizRepository $quizRepository,
|
||||
private readonly TranslatorInterface $translator,
|
||||
private readonly QuizCandidateRepository $quizCandidateRepository,
|
||||
private readonly EntityManagerInterface $em,
|
||||
) {}
|
||||
|
||||
#[IsGranted(SeasonVoter::EDIT, subject: 'season')]
|
||||
@@ -190,12 +191,13 @@ class QuizController extends AbstractController
|
||||
requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'quiz' => Requirement::UUID],
|
||||
methods: ['POST'],
|
||||
)]
|
||||
public function saveCandidateAnswers(Season $season, Quiz $quiz, Question $question, Request $request, EntityManagerInterface $em): RedirectResponse
|
||||
public function saveCandidateAnswers(Season $season, Quiz $quiz, Question $question, Request $request): RedirectResponse
|
||||
{
|
||||
if (false === $season->quizzes->contains($quiz)
|
||||
|| false === $quiz->questions->contains($question)) {
|
||||
throw new BadRequestHttpException('Invalid quiz or question');
|
||||
}
|
||||
|
||||
$candidateAnswers = $request->request->all('candidate_answer');
|
||||
|
||||
// Clear existing candidate-answer associations for this question
|
||||
@@ -209,14 +211,14 @@ class QuizController extends AbstractController
|
||||
|
||||
// Add new associations
|
||||
foreach ($candidateAnswers as $candidateId => $answerIds) {
|
||||
$candidate = $em->getRepository(Candidate::class)->find($candidateId);
|
||||
$candidate = $this->em->getRepository(Candidate::class)->find($candidateId);
|
||||
|
||||
if (false === $season->candidates->contains($candidate)) {
|
||||
throw new BadRequestHttpException('Invalid candidate');
|
||||
}
|
||||
|
||||
foreach ((array) $answerIds as $answerId) {
|
||||
$answer = $em->getRepository(Answer::class)->find($answerId);
|
||||
$answer = $this->em->getRepository(Answer::class)->find($answerId);
|
||||
|
||||
if (false === $question->answers->contains($answer)) {
|
||||
throw new BadRequestHttpException('Invalid answer');
|
||||
@@ -228,7 +230,7 @@ class QuizController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('Candidate answers saved'));
|
||||
|
||||
@@ -245,10 +247,10 @@ class QuizController extends AbstractController
|
||||
name: 'tvdt_backoffice_enable',
|
||||
requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'quiz' => Requirement::UUID.'|null'],
|
||||
)]
|
||||
public function enableQuiz(Season $season, ?Quiz $quiz, EntityManagerInterface $em): RedirectResponse
|
||||
public function enableQuiz(Season $season, ?Quiz $quiz): RedirectResponse
|
||||
{
|
||||
$season->activeQuiz = $quiz;
|
||||
$em->flush();
|
||||
$this->em->flush();
|
||||
|
||||
if ($quiz instanceof Quiz) {
|
||||
return $this->redirectToRoute('tvdt_backoffice_quiz', ['seasonCode' => $season->seasonCode, 'quiz' => $quiz->id]);
|
||||
@@ -335,7 +337,7 @@ class QuizController extends AbstractController
|
||||
requirements: ['quiz' => Requirement::UUID, 'candidate' => Requirement::UUID],
|
||||
methods: ['GET'],
|
||||
)]
|
||||
public function toggleCandidate(Quiz $quiz, Candidate $candidate, EntityManagerInterface $em): RedirectResponse
|
||||
public function toggleCandidate(Quiz $quiz, Candidate $candidate): RedirectResponse
|
||||
{
|
||||
$quizCandidate = $this->quizCandidateRepository->findOneBy([
|
||||
'quiz' => $quiz,
|
||||
@@ -346,12 +348,12 @@ class QuizController extends AbstractController
|
||||
// Create new QuizCandidate if it doesn't exist (inactive by default when first toggling)
|
||||
$quizCandidate = new QuizCandidate($quiz, $candidate);
|
||||
$quizCandidate->active = false;
|
||||
$em->persist($quizCandidate);
|
||||
$this->em->persist($quizCandidate);
|
||||
} else {
|
||||
$quizCandidate->active = !$quizCandidate->active;
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('Candidate status updated'));
|
||||
|
||||
|
||||
@@ -24,12 +24,11 @@ use Tvdt\Security\EmailVerifier;
|
||||
|
||||
final class RegistrationController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EmailVerifier $emailVerifier, private readonly TranslatorInterface $translator, private readonly UserPasswordHasherInterface $userPasswordHasher, private readonly Security $security, private readonly LoggerInterface $logger, private readonly UserRepository $userRepository) {}
|
||||
public function __construct(private readonly EmailVerifier $emailVerifier, private readonly TranslatorInterface $translator, private readonly UserPasswordHasherInterface $userPasswordHasher, private readonly Security $security, private readonly LoggerInterface $logger, private readonly UserRepository $userRepository, private readonly EntityManagerInterface $entityManager) {}
|
||||
|
||||
#[Route('/register', name: 'tvdt_register')]
|
||||
public function register(
|
||||
Request $request,
|
||||
EntityManagerInterface $entityManager,
|
||||
): Response {
|
||||
$user = new User();
|
||||
$form = $this->createForm(RegistrationFormType::class, $user);
|
||||
@@ -41,8 +40,8 @@ final class RegistrationController extends AbstractController
|
||||
|
||||
$user->password = $this->userPasswordHasher->hashPassword($user, $plainPassword);
|
||||
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
$this->entityManager->persist($user);
|
||||
$this->entityManager->flush();
|
||||
|
||||
try {
|
||||
// generate a signed url and email it to the user
|
||||
|
||||
@@ -15,9 +15,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Tvdt\Entity\User;
|
||||
|
||||
/**
|
||||
* @extends AbstractType<User>
|
||||
*/
|
||||
/** @extends AbstractType<User> */
|
||||
class RegistrationFormType extends AbstractType
|
||||
{
|
||||
public function __construct(private readonly TranslatorInterface $translator) {}
|
||||
|
||||
@@ -8,9 +8,7 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Tvdt\Entity\Answer;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Answer>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<Answer> */
|
||||
class AnswerRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -11,9 +11,7 @@ use Tvdt\Entity\Candidate;
|
||||
use Tvdt\Entity\Season;
|
||||
use Tvdt\Helpers\Base64;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Candidate>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<Candidate> */
|
||||
class CandidateRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -8,9 +8,7 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Tvdt\Entity\Elimination;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Elimination>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<Elimination> */
|
||||
class EliminationRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -8,9 +8,7 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Tvdt\Entity\GivenAnswer;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<GivenAnswer>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<GivenAnswer> */
|
||||
class GivenAnswerRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -9,9 +9,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
use Tvdt\Entity\Candidate;
|
||||
use Tvdt\Entity\Question;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Question>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<Question> */
|
||||
class QuestionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -11,9 +11,7 @@ use Tvdt\Entity\Candidate;
|
||||
use Tvdt\Entity\Quiz;
|
||||
use Tvdt\Entity\QuizCandidate;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<QuizCandidate>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<QuizCandidate> */
|
||||
class QuizCandidateRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -14,9 +14,7 @@ use Tvdt\Dto\Result;
|
||||
use Tvdt\Entity\Quiz;
|
||||
use Tvdt\Exception\ErrorClearingQuizException;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Quiz>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<Quiz> */
|
||||
class QuizRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry, private readonly LoggerInterface $logger)
|
||||
@@ -55,7 +53,7 @@ class QuizRepository extends ServiceEntityRepository
|
||||
catch (\Throwable $throwable) {
|
||||
$this->logger->error($throwable->getMessage());
|
||||
$em->rollback();
|
||||
throw new ErrorClearingQuizException(previous: $throwable);
|
||||
throw new ErrorClearingQuizException(message: $throwable->getMessage(), code: $throwable->getCode(), previous: $throwable);
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
@@ -9,9 +9,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
use Tvdt\Entity\Season;
|
||||
use Tvdt\Entity\User;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Season>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<Season> */
|
||||
class SeasonRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
@@ -8,9 +8,7 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Tvdt\Entity\SeasonSettings;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<SeasonSettings>
|
||||
*/
|
||||
/** @extends ServiceEntityRepository<SeasonSettings> */
|
||||
class SeasonSettingsRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
Reference in New Issue
Block a user