src/EventSubscriber/Delete/PackagesConsolidationReadinessSubscriber.php line 29
<?php
namespace App\EventSubscriber\Delete;
use ApiPlatform\Validator\ValidatorInterface;
use App\Event\Delete\BoxReadyForConsolidationEvent;
use App\Event\Expediting\ShippingSegmentEventInterface;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelInterface;
readonly class PackagesConsolidationReadinessSubscriber implements EventSubscriberInterface
{
use BoxMoverTrait;
public function __construct(
private KernelInterface $kernel,
private EntityManagerInterface $entityManager,
private ValidatorInterface $validator,
) {}
public static function getSubscribedEvents(): array
{
return [
BoxReadyForConsolidationEvent::IDENTIFIER => ['handle', -100],
];
}
public function handle(ShippingSegmentEventInterface $event): void
{
$shippingSegment = $event->getShippingSegment();
$this->move($shippingSegment);
}
}