events/Classes/Controller/EventController.php
Daniel Siepmann bae680025e
Flush corresponding page caches on import (#25)
The pages now receive proper cache tags.
The import now properly clears those cache tags.
That way all corresponding pages will show updated content after import
finished.

We need one test that executes frontend requests and import command.
The separation is therefore removed and tests are streamlined to have a
single parent providing all necessary information and setup.
2023-06-19 10:13:26 +02:00

76 lines
2 KiB
PHP

<?php
namespace Wrm\Events\Controller;
use TYPO3\CMS\Extbase\Annotation as Extbase;
use Wrm\Events\Domain\Model\Dto\EventDemandFactory;
use Wrm\Events\Domain\Model\Event;
use Wrm\Events\Domain\Repository\EventRepository;
use Wrm\Events\Service\DataProcessingForModels;
class EventController extends AbstractController
{
/**
* @var EventRepository
*/
protected $eventRepository;
/**
* @var DataProcessingForModels
*/
protected $dataProcessing;
/**
* @var EventDemandFactory
*/
protected $demandFactory;
public function __construct(
EventRepository $eventRepository,
DataProcessingForModels $dataProcessing,
EventDemandFactory $demandFactory
) {
$this->eventRepository = $eventRepository;
$this->dataProcessing = $dataProcessing;
$this->demandFactory = $demandFactory;
}
protected function initializeAction(): void
{
parent::initializeAction();
$this->dataProcessing->setConfigurationManager($this->configurationManager);
}
public function listAction(): void
{
$demand = $this->demandFactory->fromSettings($this->settings);
$events = $this->eventRepository->findByDemand($demand);
$this->view->assign('events', $events);
}
/**
* @Extbase\IgnoreValidation("event")
*/
public function showAction(Event $event): void
{
$this->view->assign('event', $event);
}
/**
* @deprecated Use listAction instead and configure settings properly.
* Use Settings or something else to switch between list and teaser rendering.
*/
public function teaserAction(): void
{
$this->view->assignMultiple([
'events' => $this->eventRepository->findByUids($this->settings['eventUids']),
]);
}
public function searchAction(string $search = ''): void
{
$this->view->assign('search', $search);
$this->view->assign('events', $this->eventRepository->findSearchWord($search));
}
}