src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
private function setOrderType($data, ApiOrderInterface $order, $patch = false)
    {
        // get OrderType
        $type = $this->getProperty($data, 'type', $order->getType());
        // set order type
        if (isset($data['type'])) {
            if (is_array($type) && isset($type['id'])) {
                // if provided as array
                $typeId = $type['id'];
            } elseif (is_numeric($type)) {
                // if is numeric
                $typeId = $type;
            } else {
                throw new OrderException('No typeid given');
            }
        } elseif (!$patch) {
            // default type is manual
            $typeId = OrderType::MANUAL;
        } else {
            // keep current type
            return;
        }

        // get entity
        $orderType = $this->getOrderTypeEntityById($typeId);
        if (!$orderType) {
            throw new EntityNotFoundException(static::$orderTypeEntityName, $typeId);
        }

        // set order type
        $order->setType($orderType);
    }
private function setOrderType($data, ApiOrderInterface $order, $patch = false)
    {
        // get OrderType
        $type = $this->getProperty($data, 'type', $order->getType());
        // set order type
        if (isset($data['type'])) {
            if (is_array($type) && isset($type['id'])) {
                // if provided as array
                $typeId = $type['id'];
            } elseif (is_numeric($type)) {
                // if is numeric
                $typeId = $type;
            } else {
                throw new OrderException('No typeid given');
            }
        } elseif (!$patch) {
            // default type is manual
            $typeId = OrderType::MANUAL;
        } else {
            // keep current type
            return;
        }

        // get entity
        $orderType = $this->getOrderTypeEntityById($typeId);
        if (!$orderType) {
            throw new EntityNotFoundException(static::$orderTypeEntityName, $typeId);
        }

        // set order type
        $order->setType($orderType);
    }
private function setOrderType ( $ data , ApiOrderInterface $ order , $ patch = false ) { // get OrderType $ type = $ this -> getProperty ( $ data , 'type' , $ order -> getType ( ) ) ; // set order type if ( isset ( $ data [ 'type' ] ) ) { if ( is_array ( $ type ) && isset ( $ type [ 'id' ] ) ) { // if provided as array $ typeId = $ type [ 'id' ] ; } elseif ( is_numeric ( $ type ) ) { // if is numeric $ typeId = $ type ; } else { throw new OrderException ( 'No typeid given' ) ; } } elseif ( ! $ patch ) { // default type is manual $ typeId = OrderType :: MANUAL ; } else { // keep current type return ; } // get entity $ orderType = $ this -> getOrderTypeEntityById ( $ typeId ) ; if ( ! $ orderType ) { throw new EntityNotFoundException ( static :: $ orderTypeEntityName , $ typeId ) ; } // set order type $ order -> setType ( $ orderType ) ; }
Sets OrderType on an order

@param array $data
@param ApiOrderInterface $order

@throws EntityNotFoundException
@throws OrderException
Sets OrderType on an order