*/ final readonly class GetShopPickupExceptionsQuery implements Query { public function __construct( private ShopRepository $shopRepository, private PickupSchedulingService $pickupService, ) { } /** * @param \App\Queries\Shops\GetShopPickupExceptionsQueryInput $input */ #[\Override] public function __invoke(QueryInput $input): GetShopPickupExceptionsQueryOutput { Assert::isInstanceOf($input, GetShopPickupExceptionsQueryInput::class); $shop = $input->shop; $shop->load('pickupExceptions'); $domainShop = $this->shopRepository->find($shop->getId()); if ($domainShop === null) { throw new NotFoundHttpException('Shop not found in domain'); } $pickupExceptions = $this->pickupService->getEditablePickupExceptionsFor($domainShop); $pickupDay = $this->pickupService->getPickupDay(); $pickupPeriod = $this->pickupService->getPeriodFromPickUpDay(); return new GetShopPickupExceptionsQueryOutput( shop: ShopDto::fromModel($shop), pickupExceptions: $pickupExceptions, pickupDay: $pickupDay, pickupPeriod: $pickupPeriod, ); } }