events/Classes/Events/Controller/DateListVariables.php
Daniel Siepmann 81065f5c67
BREAKING: TYPO3 v12 support (#44)
* Migrated all fixtures to PHP.
* Removed version specific adjustments.
2023-11-27 10:04:42 +01:00

60 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace WerkraumMedia\Events\Events\Controller;
use TYPO3\CMS\Core\Pagination\PaginationInterface;
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
use WerkraumMedia\Events\Domain\Model\Date;
use WerkraumMedia\Events\Domain\Model\Dto\DateDemand;
final class DateListVariables
{
private array $variables = [];
public function __construct(
private readonly array $search,
private readonly DateDemand $demand,
/**
* @var QueryResult<Date>
*/
private readonly QueryResult $dates,
private readonly PaginationInterface $pagination
) {
}
public function getSearch(): array
{
return $this->search;
}
public function getDemand(): DateDemand
{
return $this->demand;
}
/**
* @return QueryResult<Date>
*/
public function getDates(): QueryResult
{
return $this->dates;
}
public function addVariable(string $key, mixed $value): void
{
$this->variables[$key] = $value;
}
public function getVariablesForView(): array
{
return [
'search' => $this->search,
'demand' => $this->demand,
'dates' => $this->dates,
'pagination' => $this->pagination,
...$this->variables,
];
}
}