Exports the given order.
@param Order $order
@param int $foundOrder
772317
private function exportOrder(Order $order, int $foundOrder)
    {
        $logger = $this->getLogger();

        try {
            $eventDispatcher = $this->getEventDispatcher();
            $filesystem = $this->getFilesystem();

            $event = $eventDispatcher->dispatch(
                EventStore::PRE_ORDER_EXPORT,
                new PrepareOrderExportEvent($filesystem, $order)
            );

            $logger->debug(
                'Try to write the order export.',
                [
                    'file' => $file = $this->getOrderNameGenerator()->getOrderName($order),
                    'number' => $foundOrder
                ] + ($exportData = $event->getExportData())
            );

            $written = ($isStopped = $event->isPropagationStopped())
                ? false
                : $filesystem->put($file, $this->getView()->render($this->getFileTemplate(), $exportData));

            if (!$written) {
                $logger->error(
                    'Failed to write order export file.',
                    ['file' => $file, 'number' => $foundOrder, 'isStopped' => $isStopped] + $exportData
                );

                $eventDispatcher->dispatch(
                    EventStore::POST_ORDER_EXPORT_FAIL,
                    new FailedOrderExportEvent($filesystem, $order)
                );
            } else {
                $logger->info(
                    'Wrote order export file.',
                    ['file' => $file, 'number' => $foundOrder] + $exportData
                );

                $eventDispatcher->dispatch(
                    EventStore::POST_ORDER_EXPORT,
                    new FinishOrderExportEvent($file, $filesystem, $order)
                );
            }
        } catch (SkippableException $exc) {
            $logger->warning(
                'Exception while writing the order export file.',
                ['exception' => $exc, 'order' => $order]
            );

            $eventDispatcher->dispatch(
                EventStore::POST_ORDER_EXPORT_FAIL,
                (new FailedOrderExportEvent($filesystem, $order))->setException($exc)
            );
        }
    }
1056192
public function createOrderLinesByCartLines(
        OrderInterface $order,
        Collection $cartLines
    ) {
        $orderLines = new ArrayCollection();

        /**
         * @var CartLineInterface $cartLine
         */
        foreach ($cartLines as $cartLine) {
            $orderLine = $this
                ->createOrderLineByCartLine(
                    $order,
                    $cartLine
                );

            $cartLine->setOrderLine($orderLine);
            $orderLines->add($orderLine);
        }

        return $orderLines;
    }
706280
public function createOrderLineByCartLine(
        OrderInterface $order,
        CartLineInterface $cartLine
    ) {
        $orderLine = ($cartLine->getOrderLine() instanceof OrderLineInterface)
            ? $cartLine->getOrderLine()
            : $this->orderLineFactory->create();

        /**
         * @var OrderLineInterface $orderLine
         */
        $orderLine
            ->setOrder($order)
            ->setPurchasable($cartLine->getPurchasable())
            ->setQuantity($cartLine->getQuantity())
            ->setPurchasableAmount($cartLine->getPurchasableAmount())
            ->setAmount($cartLine->getAmount())
            ->setHeight($cartLine->getHeight())
            ->setWidth($cartLine->getWidth())
            ->setDepth($cartLine->getDepth())
            ->setWeight($cartLine->getWeight());

        $this
            ->orderLineEventDispatcher
            ->dispatchOrderLineOnCreatedEvent(
                $order,
                $cartLine,
                $orderLine
            );

        return $orderLine;
    }
834042
private function findTransformedItem(OrderInterface $order, OrderItemInterface $transformed)
    {
        foreach ($order->getItems() as $item) {
            if ($item->equals($transformed)) {
                return $item;
            }
        }

        return null;
    }
1080198
public function getFieldByOrder($order)
    {
        foreach ($this->_fields as $field) {
            if ($field instanceof FieldInterface) {
                if ($field->getOrder() == $order) {
                    return $field;
                }
            }
        }

        return null;
    }
924031
public function addSorting($sort, $order = SearchQuery::SORT_ASC)
    {
        $this->searchQuery->addSorting($sort, $order);

        return $this;
    }
56888
protected function getOrderBys($order)
    {
        $separatedOrders = [$order];

        if ($this->isMultiOrderQuery($order)) {
            $separatedOrders = explode(',', $order);
        }

        return $separatedOrders;
    }
75719
public function sell(OrderInterface $order): void
    {
        $this->lockProductVariants($order);

        $this->decoratedOperator->sell($order);
    }
750634
public function addOrderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true);
    }
1212865
public function transform(Order $order)
    {
        foreach ($order->meta() as $key => $total) {
            $payload[$key] = $this->converter->convert($total);
        }

        $payload['products'] = [];

        foreach ($order->products() as $product) {
            $payload['products'][] = array_map(function ($value) {
                return $this->converter->convert($value);
            }, $product);
        }

        return json_encode($payload);
    }
1344585
public function addSort($field, $order = self::SORT_DECREASE) {
        if ($this->searchParams->sort == null) {
            $this->searchParams->sort = new Sort();
            $this->searchParams->sort->sortFields = array();
        }
        $sortField = new SortField(array('field' => $field, 'order' => $order));
        $this->searchParams->sort->sortFields[] = $sortField;
    }
358959
public function renderECommerceTracking(\Twig_Environment $environment, Order $order)
    {
        $order = $this->orderPreparer->prepare($order);
        $options = $this->orderConverter->convert($order);
        $template = $environment->loadTemplate(
            'KunstmaanSeoBundle:GoogleAnalyticsTwigExtension:ecommerce_tracking.html.twig'
        );

        return $template->render($options);
    }
543538
public function receiveAction(Order $order)
    {
        $order->receiveByHub();

        $em = $this->getDoctrine()->getEntityManager();
        $em->persist($order);
        $em->flush();

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
951994
public function setOrder(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Order $order = null)
    {
        $this->order = $order;

        return $this;
    }
1239496
public function update(Order $order)
    {
        if ($this->sgOrder->getUpdatePayment()) {
            $order->setIsPaid($this->sgOrder->getIsPaid());
        }

        if ($this->sgOrder->getUpdateShipping()) {
            $order->setIsShippingBlocked($this->sgOrder->getIsShippingBlocked());
        }
    }
1042846
public function orderBy($order = null) {
		if (is_null($order)) //remove option
			return $this->discard('query.orderBy');
			
		return $this->merge(['query.orderBy' => func_get_args()]);
	}
486208
public function removeOrderFromAvailableOrders($order)
    {
        $this->loadAvailableOrders();

        if (isset($this->availableOrder[$order])) {
            unset($this->availableOrder[$order]);
        }

        return $this;
    }