mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-20 05:16:12 +02:00
tea/Classes/Controller/RatingController.php

30 lines
686 B
PHP

<?php
namespace TTN\Tea\Controller;
use TTN\Tea\Domain\Model\Tea;
use TTN\Tea\Domain\Repository\TeaRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class RatingController extends ActionController
{
public function __construct(protected TeaRepository $teaRepository)
{
}
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();
}
}