vendor/pimcore/data-hub/src/Controller/GraphQLExplorerController.php line 37

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Bundle\DataHubBundle\Controller;
  15. use Pimcore\Bundle\DataHubBundle\GraphQL\Service;
  16. use Pimcore\Bundle\DataHubBundle\Service\CheckConsumerPermissionsService;
  17. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
  18. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  19. use Symfony\Component\HttpFoundation\Request;
  20. use Symfony\Component\Routing\RouterInterface;
  21. class GraphQLExplorerController extends AbstractController
  22. {
  23.     /**
  24.      * @param RouterInterface $routingService
  25.      * @param Request $request
  26.      *
  27.      * @Cache(expires="tomorrow", public=true)
  28.      *
  29.      * @return \Symfony\Component\HttpFoundation\Response
  30.      *
  31.      * @throws \Exception
  32.      */
  33.     public function explorerAction(RouterInterface $routingServiceRequest $requestService $service)
  34.     {
  35.         $tagManagerListener $service->getTagManagerListener();
  36.         // disable Tag & Snippet Management
  37.         if ($tagManagerListener) {
  38.             $tagManagerListener->disable();
  39.         }
  40.         $urlParams array_merge($request->request->all(), $request->query->all());
  41.         $clientName $request->get('clientname');
  42.         $url $routingService->generate('admin_pimcoredatahub_webservice', ['clientname' => $clientName]);
  43.         if (!$url) {
  44.             throw new \Exception('unable to resolve');
  45.         }
  46.         if ($urlParams) {
  47.             $url $url '?' http_build_query($urlParams);
  48.         }
  49.         return $this->render('@PimcoreDataHub/Feature/explorer.html.twig', [
  50.             'graphQLUrl' => $url,
  51.             'tokenHeader' => CheckConsumerPermissionsService::TOKEN_HEADER
  52.         ]);
  53.     }
  54. }