src/Manager/ConsignmentManager.php
public function dispatch(DispatchConfirmationInterface $dispatchConfirmation)
    {
        try {
            $event = new EventDispatchConfirmation($dispatchConfirmation);
            $this->eventDispatcher->dispatch(Events::PRE_CONSIGNMENTS_DISPATCH, $event);

            $adapter = $this->getAdapter($dispatchConfirmation->getConsignments()->first());

            $adapter->dispatch($dispatchConfirmation);
            $this->dispatchConfirmationRepository->saveDispatchConfirmation($dispatchConfirmation);

            foreach ($dispatchConfirmation->getConsignments() as $consignment) {
                $consignment->setDispatchConfirmation($dispatchConfirmation);
                $previousStatus = $consignment->getStatus();

                /** @var ParcelInterface $parcel */
                foreach ($consignment->getParcels() as $parcel) {
                    $parcel->setStatus(ConsignmentStatusList::STATUS_DISPATCHED);
                }
                $consignment->setStatus(ConsignmentStatusList::STATUS_DISPATCHED);

                $this->consignmentRepository->saveConsignment($consignment);

                $this->dispatchOnConsignmentStatusChange($consignment, $previousStatus);
            }

            $event = new EventDispatchConfirmation($dispatchConfirmation);
            $this->eventDispatcher->dispatch(Events::POST_CONSIGNMENTS_DISPATCH, $event);
        } catch (\Exception $e) {
            throw new VendorAdapterException('Error during consignments dispatching.', null, $e);
        }
    }
public function dispatch(DispatchConfirmationInterface $dispatchConfirmation)
    {
        try {
            $event = new EventDispatchConfirmation($dispatchConfirmation);
            $this->eventDispatcher->dispatch(Events::PRE_CONSIGNMENTS_DISPATCH, $event);

            $adapter = $this->getAdapter($dispatchConfirmation->getConsignments()->first());

            $adapter->dispatch($dispatchConfirmation);
            $this->dispatchConfirmationRepository->saveDispatchConfirmation($dispatchConfirmation);

            foreach ($dispatchConfirmation->getConsignments() as $consignment) {
                $consignment->setDispatchConfirmation($dispatchConfirmation);
                $previousStatus = $consignment->getStatus();

                /** @var ParcelInterface $parcel */
                foreach ($consignment->getParcels() as $parcel) {
                    $parcel->setStatus(ConsignmentStatusList::STATUS_DISPATCHED);
                }
                $consignment->setStatus(ConsignmentStatusList::STATUS_DISPATCHED);

                $this->consignmentRepository->saveConsignment($consignment);

                $this->dispatchOnConsignmentStatusChange($consignment, $previousStatus);
            }

            $event = new EventDispatchConfirmation($dispatchConfirmation);
            $this->eventDispatcher->dispatch(Events::POST_CONSIGNMENTS_DISPATCH, $event);
        } catch (\Exception $e) {
            throw new VendorAdapterException('Error during consignments dispatching.', null, $e);
        }
    }
Dispatches consignments with given DispatchConfirmation
@param DispatchConfirmationInterface $dispatchConfirmation