src/Controller/DocumentController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Pimcore\Controller\FrontendController;
  4. use Pimcore\Model\DataObject\Room;
  5. use Pimcore\Model\Exception\NotFoundException;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  7. use Symfony\Component\HttpFoundation\{RequestResponse};
  8. use Symfony\Component\Routing\Annotation\Route;
  9. /**
  10.  * Class DocumentController
  11.  * @package App\Controller
  12.  */
  13. class DocumentController extends FrontendController
  14. {
  15.     /**
  16.      * @Template("@Provider/document/room.html.twig")
  17.      */
  18.     public function roomDetailAction(Request $request): array
  19.     {
  20.         $room Room::getById($request->get('id'));
  21.         if (empty($room)) {
  22.             throw new NotFoundException('Room not Found');
  23.         }
  24.         return [
  25.             'roomElement' => $room
  26.         ];
  27.     }
  28. }