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
|
|
|
|
|
|
|
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
|
2023-11-27 10:04:42 +01:00
|
|
|
use WerkraumMedia\Events\Domain\Model\Category;
|
2023-11-09 10:27:43 +01:00
|
|
|
use WerkraumMedia\Events\Domain\Model\Dto\DateDemand;
|
|
|
|
use WerkraumMedia\Events\Domain\Model\Region;
|
2022-07-11 08:59:32 +02:00
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
final class DateSearchVariables
|
2022-07-11 08:59:32 +02:00
|
|
|
{
|
2023-11-27 10:04:42 +01:00
|
|
|
private array $variables = [];
|
2022-07-11 08:59:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param QueryResultInterface<Region> $regions
|
2023-11-27 10:04:42 +01:00
|
|
|
* @param array<Category> $categories
|
|
|
|
* @param array<Category> $features
|
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,
|
|
|
|
private readonly QueryResultInterface $regions,
|
|
|
|
private readonly array $categories,
|
|
|
|
private readonly array $features
|
2022-07-11 08:59:32 +02:00
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSearch(): array
|
|
|
|
{
|
|
|
|
return $this->search;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDemand(): DateDemand
|
|
|
|
{
|
|
|
|
return $this->demand;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return QueryResultInterface<Region>
|
|
|
|
*/
|
|
|
|
public function getRegions(): QueryResultInterface
|
|
|
|
{
|
|
|
|
return $this->regions;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCategories(): array
|
|
|
|
{
|
|
|
|
return $this->categories;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFeatures(): array
|
|
|
|
{
|
|
|
|
return $this->features;
|
|
|
|
}
|
|
|
|
|
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,
|
|
|
|
'regions' => $this->regions,
|
|
|
|
'categories' => $this->categories,
|
|
|
|
'features' => $this->features,
|
2023-11-27 10:04:42 +01:00
|
|
|
...$this->variables,
|
|
|
|
];
|
2022-07-11 08:59:32 +02:00
|
|
|
}
|
|
|
|
}
|