src/UseCase/PaymentPercent/Event/EventSubscriber.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\UseCase\PaymentPercent\Event;
  3. use App\UseCase\PaymentPercent\Calculate\PaymentPercentCalculateHandler;
  4. use App\UseCase\Wage\WageCalculateHandler;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class EventSubscriber implements EventSubscriberInterface
  7. {
  8.     public function __construct(
  9.         private PaymentPercentCalculateHandler $paymentPercentCalculateHandler,
  10.         private WageCalculateHandler $wageCalculateHandler,
  11.     ) {}
  12.     public static function getSubscribedEvents(): array
  13.     {
  14.         return [
  15.             PaymentPercentagesChangeEvent::NAME => 'onChange',
  16.         ];
  17.     }
  18.     /**
  19.      * После изменения условий процентных ставок - пересчитываем процент и зп
  20.      *
  21.      * @param PaymentPercentagesChangeEvent $event
  22.      *
  23.      * @return void
  24.      */
  25.     public function onChange(PaymentPercentagesChangeEvent $event): void
  26.     {
  27.         $paymentPercent $this->paymentPercentCalculateHandler->handleFromPercentages(
  28.             $event->getPercentages(),
  29.             $event->getReportingDate(),
  30.         );
  31. //        if ($paymentPercent) {
  32. //            $this->wageCalculateHandler->handleFromPaymentPercent($paymentPercent);
  33. //        }
  34.     }
  35. }