2022-07-11 08:59:32 +02:00
|
|
|
<?php
|
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2023-11-09 10:27:43 +01:00
|
|
|
namespace WerkraumMedia\Events\Events\Controller;
|
2022-07-11 08:59:32 +02:00
|
|
|
|
2022-08-02 17:15:47 +02:00
|
|
|
use TYPO3\CMS\Core\Pagination\PaginationInterface;
|
2022-07-11 08:59:32 +02:00
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
|
2023-11-09 10:27:43 +01:00
|
|
|
use WerkraumMedia\Events\Domain\Model\Date;
|
|
|
|
use WerkraumMedia\Events\Domain\Model\Dto\DateDemand;
|
2022-07-11 08:59:32 +02:00
|
|
|
|
|
|
|
final class DateListVariables
|
|
|
|
{
|
2023-11-27 10:04:42 +01:00
|
|
|
private array $variables = [];
|
2022-07-11 08:59:32 +02:00
|
|
|
|
|
|
|
public function __construct(
|
2023-11-27 10:04:42 +01:00
|
|
|
private readonly array $search,
|
|
|
|
private readonly DateDemand $demand,
|
|
|
|
/**
|
|
|
|
* @var QueryResult<Date>
|
|
|
|
*/
|
|
|
|
private readonly QueryResult $dates,
|
|
|
|
private readonly PaginationInterface $pagination
|
2022-07-11 08:59:32 +02:00
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSearch(): array
|
|
|
|
{
|
|
|
|
return $this->search;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDemand(): DateDemand
|
|
|
|
{
|
|
|
|
return $this->demand;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return QueryResult<Date>
|
|
|
|
*/
|
|
|
|
public function getDates(): QueryResult
|
|
|
|
{
|
|
|
|
return $this->dates;
|
|
|
|
}
|
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
public function addVariable(string $key, mixed $value): void
|
2022-07-11 08:59:32 +02:00
|
|
|
{
|
|
|
|
$this->variables[$key] = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getVariablesForView(): array
|
|
|
|
{
|
2023-11-27 10:04:42 +01:00
|
|
|
return [
|
2022-07-11 08:59:32 +02:00
|
|
|
'search' => $this->search,
|
|
|
|
'demand' => $this->demand,
|
|
|
|
'dates' => $this->dates,
|
2022-08-02 17:15:47 +02:00
|
|
|
'pagination' => $this->pagination,
|
2023-11-27 10:04:42 +01:00
|
|
|
...$this->variables,
|
|
|
|
];
|
2022-07-11 08:59:32 +02:00
|
|
|
}
|
|
|
|
}
|