1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Module\Holiday\UseCase\Command;
6
7
use App\Module\Holiday\DTO\PublicHolidayCalendarDTO;
8
use App\Shared\Facade\DateNagerInterface;
9
10
final readonly class SyncCalendarCommandHandler
11
{
12
public function __construct(
Igor
5d01a4e
13
private DateNagerInterface $dateNager,
14
private CalendarRepositoryInterface $calendarRepository,
15
) {}
16
17
public function __invoke(SyncCalendarCommand $command): void
18
{
19
[$countryCode, $countryName, $year] = $command->unpack();
20
$holidays = $this->dateNager->getHolidaysForCountry($countryCode, $year);
21
$dto = PublicHolidayCalendarDTO::createFromNager($countryCode, $countryName, $holidays);
22
$this->calendarRepository->upsertByCountryCode($dto, $year);
23
}
24
}
Who’s out of office?
A small Symfony service for public-holiday calendars, leave requests, and reliable working-day calculations.
Holiday synchronization
Sync a country calendar from DateNager and upsert it without replacing local leave data.
- ☑ Fetch public holidays by country and year
- ☑ Map the provider response into calendar DTOs
- ☐ Schedule the production sync
bin/console app:holiday:sync --country=DE