<?php
namespace App\Controller;
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 PromotionDetailController implements RendererAwareInterface
{
use RendererControllerTrait;
private PromotionRepositoryInterface $promotionRepository;
public function __construct(PromotionRepositoryInterface $promotionRepository)
{
$this->promotionRepository = $promotionRepository;
}
public function __invoke($contentDocument)
{
$relatedPromotions = $this->promotionRepository->getRelated($contentDocument);
return $this->render(
'default/promotions_detail.html.twig',
[
'promotion' => $contentDocument,
'relatedPromotions' => $relatedPromotions,
]
);
}
}