mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-04 20:16:13 +01:00
tea/Classes/Controller/TeaController.php
Oliver Klee eeda862e77
[!!!][TASK] Drop additional namespace segment for the Tea model (#1025)
The `Product` namespace segment in the domain model namespace
`TTN\Tea\Domain\Model` currently serves no purpose and only adds
confusion. So let's simplify the extension structure accordingly.

(I intended to use this to demonstrate DDD contexts, but never
built enough models in the Tea extension for this to actually
make sense.)

Fixes #1008
2024-01-16 15:21:21 +01:00

35 lines
827 B
PHP

<?php
declare(strict_types=1);
namespace TTN\Tea\Controller;
use Psr\Http\Message\ResponseInterface;
use TTN\Tea\Domain\Model\Tea;
use TTN\Tea\Domain\Repository\TeaRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
* Controller for the main "Tea" FE plugin.
*/
class TeaController extends ActionController
{
private TeaRepository $teaRepository;
public function __construct(TeaRepository $teaRepository)
{
$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();
}
}