<?php
namespace App\Controller;
use App\Entity\Hotel;
use App\Repository\Interfaces\PromotionRepositoryInterface;
use WAM\Bundle\CoreBundle\Controller\Traits\RendererControllerTrait;
use WAM\Bundle\CoreBundle\Util\Interfaces\RendererAwareInterface;
/**
* @author Gerard Rico <grico@wearemarketing.com>
*/
class RoomListController implements RendererAwareInterface
{
use RendererControllerTrait;
private PromotionRepositoryInterface $promotionRepository;
/**
* RoomListController constructor.
* @param PromotionRepositoryInterface $promotionRepository
*/
public function __construct(PromotionRepositoryInterface $promotionRepository)
{
$this->promotionRepository = $promotionRepository;
}
public function __invoke(Hotel $contentDocument)
{
$promotions = $this->promotionRepository->getActiveByHotel($contentDocument);
return $this->render(
'default/room_list.html.twig',
[
'hotel' => $contentDocument,
'rooms' => $contentDocument->getRooms(),
'promotions' => $promotions,
]
);
}
}