src/Controller/RoomListController.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Hotel;
  4. use App\Repository\Interfaces\PromotionRepositoryInterface;
  5. use WAM\Bundle\CoreBundle\Controller\Traits\RendererControllerTrait;
  6. use WAM\Bundle\CoreBundle\Util\Interfaces\RendererAwareInterface;
  7. /**
  8.  * @author Gerard Rico <grico@wearemarketing.com>
  9.  */
  10. class RoomListController implements RendererAwareInterface
  11. {
  12.     use RendererControllerTrait;
  13.     private PromotionRepositoryInterface $promotionRepository;
  14.     /**
  15.      * RoomListController constructor.
  16.      * @param PromotionRepositoryInterface $promotionRepository
  17.      */
  18.     public function __construct(PromotionRepositoryInterface $promotionRepository)
  19.     {
  20.         $this->promotionRepository $promotionRepository;
  21.     }
  22.     public function __invoke(Hotel $contentDocument)
  23.     {
  24.         $promotions $this->promotionRepository->getActiveByHotel($contentDocument);
  25.         return $this->render(
  26.             'default/room_list.html.twig',
  27.             [
  28.                 'hotel' => $contentDocument,
  29.                 'rooms' => $contentDocument->getRooms(),
  30.                 'promotions' => $promotions,
  31.             ]
  32.         );
  33.     }
  34. }