<?php
declare(strict_types=1);
namespace App\Bundles\DiagnosisBundle\EventListener;
use App\Bundles\DiagnosisBundle\Event\DiagnosisUpdatedEvent;
use App\Bundles\DiagnosisBundle\Service\Diagnosis\DiagnosisSynchronizer;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: DiagnosisUpdatedEvent::class, method: 'postUpdated')]
class DiagnosisUpdatedEventListener
{
public function __construct(
private readonly DiagnosisSynchronizer $diagnosisSynchronizer,
) {
}
public function postUpdated(DiagnosisUpdatedEvent $event): void
{
$this->diagnosisSynchronizer->synchronize($event->diagnosis, $event->previousValue);
}
}