Elcodi\Admin\CartBundle\Controller\OrderController::editAction PHP Method

editAction() public method

Edit and Saves order
public editAction ( Elcodi\Component\Cart\Entity\Interfaces\OrderInterface $order ) : array
$order Elcodi\Component\Cart\Entity\Interfaces\OrderInterface Order
return array Data
    public function editAction(OrderInterface $order)
    {
        $nextPaymentTransitions = $this->get('elcodi.order.payment_states_machine')->getAvailableStates($order->getPaymentStateLineStack()->getLastStateLine()->getName());
        $nextShippingTransitions = $this->get('elcodi.order.shipping_states_machine')->getAvailableStates($order->getShippingStateLineStack()->getLastStateLine()->getName());
        $allStates = array_merge($order->getPaymentStateLineStack()->getStateLines()->toArray(), $order->getShippingStateLineStack()->getStateLines()->toArray());
        usort($allStates, function (StateLineInterface $a, StateLineInterface $b) {
            return $a->getCreatedAt() == $b->getCreatedAt() ? $a->getId() > $b->getId() : $a->getCreatedAt() > $b->getCreatedAt();
        });
        $addressFormatter = $this->get('elcodi.formatter.address');
        $deliveryAddress = $order->getDeliveryAddress();
        $deliveryInfo = $addressFormatter->toArray($deliveryAddress);
        $billingAddress = $order->getBillingAddress();
        $billingInfo = $addressFormatter->toArray($billingAddress);
        return ['order' => $order, 'nextPaymentTransitions' => $nextPaymentTransitions, 'nextShippingTransitions' => $nextShippingTransitions, 'allStates' => $allStates, 'deliveryInfo' => $deliveryInfo, 'billingInfo' => $billingInfo];
    }