src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
private function setCustomerAccount($data, Order $order, $patch = false)
    {
        $accountData = $this->getProperty($data, 'customerAccount');
        if ($accountData) {
            if (!array_key_exists('id', $accountData)) {
                throw new MissingOrderAttributeException('account.id');
            }
            $account = $this->accountRepository->find($accountData['id']);
            if (!$account) {
                throw new OrderDependencyNotFoundException('Account', $accountData['id']);
            }
            $order->setCustomerAccount($account);

            return $account;
        } elseif (!$patch) {
            $order->setCustomerAccount(null);
        }

        return null;
    }
private function setCustomerAccount($data, Order $order, $patch = false)
    {
        $accountData = $this->getProperty($data, 'customerAccount');
        if ($accountData) {
            if (!array_key_exists('id', $accountData)) {
                throw new MissingOrderAttributeException('account.id');
            }
            $account = $this->accountRepository->find($accountData['id']);
            if (!$account) {
                throw new OrderDependencyNotFoundException('Account', $accountData['id']);
            }
            $order->setCustomerAccount($account);

            return $account;
        } elseif (!$patch) {
            $order->setCustomerAccount(null);
        }

        return null;
    }
private function setCustomerAccount ( $ data , Order $ order , $ patch = false ) { $ accountData = $ this -> getProperty ( $ data , 'customerAccount' ) ; if ( $ accountData ) { if ( ! array_key_exists ( 'id' , $ accountData ) ) { throw new MissingOrderAttributeException ( 'account.id' ) ; } $ account = $ this -> accountRepository -> find ( $ accountData [ 'id' ] ) ; if ( ! $ account ) { throw new OrderDependencyNotFoundException ( 'Account' , $ accountData [ 'id' ] ) ; } $ order -> setCustomerAccount ( $ account ) ; return $ account ; } elseif ( ! $ patch ) { $ order -> setCustomerAccount ( null ) ; } return null ; }
Sets the customer account of an order

@param array $data
@param Order $order
@param bool $patch

@return null|object
@throws MissingOrderAttributeException
@throws OrderDependencyNotFoundException
Sets the customer account of an order