src/Controller/TorqServiceController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use InvalidArgumentException;
  4. use Pimcore\Controller\FrontendController;
  5. use Pimcore\Model\DataObject;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class TorqServiceController extends FrontendController
  8. {
  9.     /**
  10.      * @Route("/services/{torqServiceSlug}", name="torq_service_detail")
  11.      */
  12.     public function detailAction(string $torqServiceSlug
  13.     {
  14.         $torqService DataObject\TorqService::getBySlug($torqServiceSlug1);
  15.         if(!$torqService){
  16.             throw new InvalidArgumentException('Service does not exist');
  17.         }
  18.         return $this->render('content/torqService.html.twig', [
  19.             'torqService' => $torqService
  20.         ]);
  21.     }
  22. }