src/V4/Controller/Tab/GetTabFormAction.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\V4\Controller\Tab;
  3. use App\Model\Form\FormSchema;
  4. use App\V4\Service\Tab\TabFormHandler;
  5. use App\V4\Voters\TabVoter;
  6. use ReflectionException;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
  10. use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
  11. use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
  12. use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
  13. use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
  14. class GetTabFormAction extends AbstractController
  15. {
  16.     /**
  17.      * @var TabFormHandler
  18.      */
  19.     private $tabFormHandler;
  20.     /**
  21.      * @param TabFormHandler $tabFormHandler
  22.      */
  23.     public function __construct(TabFormHandler $tabFormHandler)
  24.     {
  25.         $this->tabFormHandler $tabFormHandler;
  26.     }
  27.     /**
  28.      * @param Request     $request
  29.      * @param string|null $id
  30.      *
  31.      * @return FormSchema|array
  32.      *
  33.      * @throws ClientExceptionInterface
  34.      * @throws DecodingExceptionInterface
  35.      * @throws RedirectionExceptionInterface
  36.      * @throws ReflectionException
  37.      * @throws ServerExceptionInterface
  38.      * @throws TransportExceptionInterface
  39.      */
  40.     public function __invoke(Request $requeststring $id null)
  41.     {
  42.         $this->denyAccessUnlessGranted(TabVoter::TAB_ADD_EDIT);
  43.         return $this->tabFormHandler->getTabForm($id$request->get('customerId'));
  44.     }
  45. }