src/Controller/Product/GetProductSearchFormAction.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Product;
  3. use App\Model\Form\FormSchema;
  4. use App\Service\Product\ProductFormHandler;
  5. use App\Voters\ProductVoter;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Request;
  8. class GetProductSearchFormAction extends AbstractController
  9. {
  10.     /**
  11.      * @var ProductFormHandler
  12.      */
  13.     private $productFormHandler;
  14.     /**
  15.      * @param ProductFormHandler $productFormHandler
  16.      */
  17.     public function __construct(ProductFormHandler $productFormHandler)
  18.     {
  19.         $this->productFormHandler $productFormHandler;
  20.     }
  21.     /**
  22.      * @return FormSchema|array
  23.      */
  24.     public function __invoke(Request $request)
  25.     {
  26.         $this->denyAccessUnlessGranted(ProductVoter::PRODUCT_SHOW_LIST);
  27.         return $this->productFormHandler->getProductSearchForm((bool) $request->query->get('isLegacy'false));
  28.     }
  29. }