2023-11-27 15:44:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace TTN\Tea\Controller;
|
|
|
|
|
2024-05-07 16:23:04 +02:00
|
|
|
use TTN\Tea\Domain\Model\Tea;
|
|
|
|
use TTN\Tea\Domain\Repository\TeaRepository;
|
|
|
|
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
2023-11-27 15:44:16 +01:00
|
|
|
|
2024-05-07 16:23:04 +02:00
|
|
|
class RatingController extends ActionController
|
2023-11-27 15:44:16 +01:00
|
|
|
{
|
2024-05-07 16:23:04 +02:00
|
|
|
|
|
|
|
public function __construct(protected TeaRepository $teaRepository)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-11-27 15:44:16 +01:00
|
|
|
public function ratingAction(Tea $tea, int $stars)
|
|
|
|
{
|
|
|
|
$tea->setStars($stars);
|
|
|
|
$this->teaRepository->update($tea);
|
|
|
|
|
|
|
|
return $this->redirect('index','FrontEndEditor');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function filterAction(int $stars)
|
|
|
|
{
|
|
|
|
$this->view->assign('teas', $this->teaRepository->findByStars($stars));
|
|
|
|
return $this->htmlResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|