<?php
declare(strict_types=1);
namespace Slivki\MessageHandler\Query\MeOnMap;
use Slivki\Message\Query\MeOnMap\GetCategoriesWithGeoLocationsQuery;
use Slivki\Response\MeOnMap\GetCategoriesWithGeoLocationsResponse;
use Slivki\Services\MeOnMap\GetCategoriesWithGeoLocationsResponseCacheService;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
final class GetCategoriesWithGeoLocationsHandler implements MessageHandlerInterface
{
private GetCategoriesWithGeoLocationsResponseCacheService $cacheService;
public function __construct(GetCategoriesWithGeoLocationsResponseCacheService $cacheService)
{
$this->cacheService = $cacheService;
}
public function __invoke(GetCategoriesWithGeoLocationsQuery $query): GetCategoriesWithGeoLocationsResponse
{
return $this->cacheService->getByCityId($query->getCityId());
}
}