src/Controller/Front/SponsorshipController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use App\EventListener\SponsorshipListener;
  4. use App\Repository\SponsorshipRepository;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. class SponsorshipController extends AbstractController
  9. {
  10.     /**
  11.      * code for a render displayed above the registration code
  12.      * @param Request $request
  13.      * @param SponsorshipRepository $sponsorshipRepository
  14.      * @return Response
  15.      * @throws \Doctrine\ORM\NonUniqueResultException
  16.      */
  17.     public function _displaySponsorshipOnRegisterPage(Request $requestSponsorshipRepository $sponsorshipRepository)
  18.     {
  19.         $token $request->getSession()->get(SponsorshipListener::TOKEN_KEY);
  20.         if ($token) {
  21.             $sponsorship $sponsorshipRepository->findSentByToken($token);
  22.             if ($sponsorship) {
  23.                 return $this->render('front_v4/mca/sponsorship/_sponsorship.html.twig', ['sponsorship' => $sponsorship]);
  24.             }
  25.         }
  26.         return new Response();
  27.     }
  28. }