src/Controller/Tenants/Tenant1/SupportController.php line 54

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Tenants\Tenant1;
  3. use App\Controller\Traits\SecurityTrait;
  4. use App\Services\reCaptcha3ValidatorService;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use App\Services\{
  7.     EntityServices\UserEntityService,
  8.     ParameterService,
  9.     Stripe\StripeService,
  10.     TenantService,
  11.     TenantFlowService
  12. };
  13. use App\Entity\{
  14.     User
  15. };
  16. use Symfony\Component\HttpFoundation\Request;
  17. use Symfony\Component\HttpFoundation\Response;
  18. use Symfony\Component\Routing\Annotation\Route;
  19. use Symfony\Component\Security\Core\Security;
  20. class SupportController extends AbstractController
  21. {
  22.     use SecurityTrait;
  23.     private $reCaptcha3ValidatorService;
  24.     private $stripeService;
  25.     private $userEntityService;
  26.     public function __construct(
  27.         StripeService $stripeService,
  28.         TenantService $tenantService,
  29.         TenantFlowService $tenantFlowService,
  30.         UserEntityService $userEntityService,
  31.         reCaptcha3ValidatorService $reCaptcha3ValidatorService,
  32.         ParameterService $parameterService
  33.     )
  34.     {
  35.         $this->stripeService $stripeService->setSDK('tenant1');
  36.         $this->tenant $tenantService->defineTenant();
  37.         $this->tenantFlowService $tenantFlowService;
  38.         $this->userEntityService $userEntityService;
  39.         $this->reCaptcha3ValidatorService $reCaptcha3ValidatorService;
  40.         $this->reCaptcha3ValidatorService->setAccess(
  41.             $parameterService->getParameter($this->tenant->getSettingsArrayAssoc()['config'] ?? 'non-existent''reCaptcha3.secretKey'),
  42.             $parameterService->getParameter($this->tenant->getSettingsArrayAssoc()['config'] ?? 'non-existent''reCaptcha3.allowableScore')
  43.         );
  44.     }
  45.     /**
  46.      * @Route("/support", name="support")
  47.      */
  48.     public function support(Request $request): Response
  49.     {
  50.         return $this->render("{$this->tenant->getRootPath()}/pages/support.html.twig", [
  51.                 'rootPath' => $this->tenant->getRootPath(),
  52.                 'userFields' => $this->tenant->getUserFieldsArray(),
  53.                 'message' => $errorMessage ?? '',
  54.             ]
  55.             + $this->tenantFlowService->prepareTemplateArguments('signUp'$this->tenant)
  56.             + $this->tenantFlowService->prepareTemplateArguments('menu'$this->tenant)
  57.         );
  58.     }
  59. }