src/V4/Controller/Contact/GetContactSearchFormAction.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\V4\Controller\Contact;
  3. use App\Model\Form\FormSchema;
  4. use App\V4\Service\Contact\ContactFormHandler;
  5. use App\V4\Voters\ContactVoter;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\JsonResponse;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Serializer\Exception\ExceptionInterface;
  10. class GetContactSearchFormAction extends AbstractController
  11. {
  12.     /**
  13.      * @var ContactFormHandler
  14.      */
  15.     private $contactFormHandler;
  16.     /**
  17.      * @param ContactFormHandler $contactFormHandler
  18.      */
  19.     public function __construct(ContactFormHandler $contactFormHandler)
  20.     {
  21.         $this->contactFormHandler $contactFormHandler;
  22.     }
  23.     /**
  24.      * @return FormSchema|JsonResponse
  25.      *
  26.      * @throws ExceptionInterface
  27.      */
  28.     public function __invoke(Request $request)
  29.     {
  30.         $this->denyAccessUnlessGranted(ContactVoter::CONTACT_SHOW_LIST);
  31.         return $this->contactFormHandler->getContactSearchForm($request->query->get('tabId'), (bool) $request->query->get('isLegacy'false));
  32.     }
  33. }