src/EventSubscriber/Order/AddPhotosToTransferQueueSubscriber.php line 30
<?php/** This file is part of the Pellipop project.** (c) Mobizel** For the full copyright and license information, please view the LICENSE* file that was distributed with this source code.*/declare(strict_types=1);namespace App\EventSubscriber\Order;use App\Entity\Order\Order;use App\Message\OrderItemPhotoMessage;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\Messenger\MessageBusInterface;use Symfony\Component\Workflow\Event\Event;use Webmozart\Assert\Assert;class AddPhotosToTransferQueueSubscriber implements EventSubscriberInterface{public function __construct(private MessageBusInterface $messageBus,) {}public function onEnter(Event $event){/** @var Order $order */$order = $event->getSubject();Assert::isInstanceOf($order, Order::class);foreach ($order->getOrderItems() as $orderItem) {foreach ($orderItem->getPhotos() as $orderItemPhoto) {$this->messageBus->dispatch(new OrderItemPhotoMessage($orderItemPhoto->getId()));}}}public static function getSubscribedEvents(){return ['workflow.order_production.enter.uploaded' => ['onEnter', 10],];}}