mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-13 03:16:13 +01:00
tea/Classes/Controller/RatingController.php
2023-11-27 15:44:16 +01:00

28 lines
741 B
PHP

<?php
namespace TTN\Tea\Controller;
use Psr\Http\Message\ResponseInterface;
use TTN\Tea\Domain\Model\Product\Tea;
use TTN\Tea\Domain\Repository\Product\TeaRepository;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
class RatingController extends FrontEndEditorController
{
public function ratingAction(Tea $tea, int $stars)
{
$this->checkIfUserIsOwner($tea);
$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();
}
}