<?php
namespace App\Controller;
use InvalidArgumentException;
use Pimcore\Controller\FrontendController;
use Pimcore\Model\DataObject;
use Symfony\Component\Routing\Annotation\Route;
class CaseStudyController extends FrontendController
{
/**
* @Route("/case-studies/{caseStudySlug}", name="case_study_detail")
*/
public function detailAction(string $caseStudySlug)
{
$caseStudy = DataObject\CaseStudy::getBySlug($caseStudySlug, 1);
if(!$caseStudy){
throw new InvalidArgumentException('Case study does not exist');
}
return $this->render('content/caseStudy.html.twig', [
'caseStudy' => $caseStudy
]);
}
}