mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 17:36:12 +01:00
tea/Classes/Controller/TeaController.php
Lina Wolf 5d3fcee00e
[TASK] Return ResponseInterface in controller actions (#597)
Co-authored-by: lina.wolf <lwolf@w-commerce.de>
2022-10-03 16:02:32 +02:00

38 lines
885 B
PHP

<?php
declare(strict_types=1);
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\Extbase\Mvc\Controller\ActionController;
/**
* Controller for the main "Tea" FE plugin.
*/
class TeaController extends ActionController
{
/**
* @var TeaRepository
*/
private $teaRepository;
public function injectTeaRepository(TeaRepository $teaRepository): void
{
$this->teaRepository = $teaRepository;
}
public function indexAction(): ResponseInterface
{
$this->view->assign('teas', $this->teaRepository->findAll());
return $this->htmlResponse();
}
public function showAction(Tea $tea): ResponseInterface
{
$this->view->assign('tea', $tea);
return $this->htmlResponse();
}
}