Processes a single order statement.

@param Order|OrderByIsNull|ExplicitOrder|string $order
@param mixed $context The processing context
@return Order|string
490927
protected function processOrder($order, $context)
    {
        if ($order instanceof Order || $order instanceof OrderByIsNull) {
            $column = $this->processColumnOrSubQuery($order->column, $context);

            if ($column === $order->column) {
                return $order;
            } elseif ($order instanceof Order) {
                return new Order($column, $order->isDescending);
            } else {
                return new OrderByIsNull($column, $order->areNullFirst);
            }
        }

        if ($order instanceof ExplicitOrder) {
            $column = $this->processColumnOrSubQuery($order->column, $context);

            $values = [];
            foreach ($order->order as $index => $value) {
                $values[$index] = $this->processValueOrSubQuery($value, $context);
            }

            if ($column === $order->column && $values === $order->order) {
                return $order;
            } else {
                return new ExplicitOrder($column, $values, $order->areOtherFirst);
            }
        }

        return $order;
    }
773886
final public function execute($command, AnCommandContext $context)
    {
        $identifier = $context->caller->getIdentifier();

        if ($context->entity instanceof AnDomainEntityAbstract) {
            $identifier = $context->entity->getIdentifier();
        }

        $type = $identifier->path;
        $type = array_pop($type);

        $parts = explode('.', $command);
        $method = '_'.($parts[0]).ucfirst($type).ucfirst($parts[1]);

        $result = null;

        if (method_exists($this, $method)) {
            $result = $this->$method($context);
        }

        if ($context->entity) {
            $result = $context->entity->execute($command, $context);
        }

        return $result;
    }
633909
protected function parseOrder($order, $options = [])
    {
        if (is_array($order)) {
            $array = [];
            foreach ($order as $key => $val) {
                if (is_numeric($key)) {
                    if (false === strpos($val, '(')) {
                        $array[] = $this->parseKey($val, $options);
                    } else {
                        $array[] = $val;
                    }
                } else {
                    $sort    = in_array(strtolower(trim($val)), ['asc', 'desc']) ? ' ' . $val : '';
                    $array[] = $this->parseKey($key, $options) . ' ' . $sort;
                }
            }
            $order = implode(',', $array);
        }

        return !empty($order) ? ' ORDER BY ' . $order : '';
    }
704072
public function order_by( $cols, $order = 'asc' ) 
	{
		if ( !is_array( $cols ) ) 
		{
			$this->orders[] = array( $cols, $order ); return $this;
		}
		else
		{
			foreach( $cols as $key => $col ) 
			{
				if ( is_numeric( $key ) ) 
				{
					$this->orders[] = array( $col, $order );	
				} 
				else 
				{
					$this->orders[] = array( $key, $col );
				}
			}
		}
		
		return $this;
	}
509144
final public function orderBy(string $orderBy, string $order = 'ASC')
    {        
       $this->query->addOrderBy($orderBy, $order);

        return $this;
    }
1248004
public function pickAction(Order $order)
    {
        $order->pickBySeller();

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

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
383028
public function orderBy(string $sort, string $order = 'ASC'): self
    {
        $order = 'ASC' === strtoupper($order) ? 'ASC' : 'DESC';
        $this->orderBy = [$sort => $order];
        return $this;
    }
831246
public function prepareOrder($order = null, $sort = null)
    {
        if ($order == null or $sort == null) {
            $this->setOrderBy = '';

            return $this;
        }

        if (!in_array($sort, ['ASC', 'DESC'])) {
            $sort = 'DESC';
        }

        $this->setOrderBy = ' ORDER BY ' . $order . ' ' . $sort;

        return $this;
    }
23696
public function orderBy($column, $order = self::ORDER_BY_ASC)
    {
        $this->orderBy[] = array('column' => $column,
            'order' => $order);

        return $this;
    }
249699
protected function createItemBagForOrder(Order $order)
    {
        if (!$this->sendCartInfo) {
            return null;
        }

        $items = $this->getItemListForOrder($order);
        $itemBagClassName = $this->getItemBagClassName();

        return new $itemBagClassName($items);
    }
1027945
protected function processTable($table, $context)
    {
        if (is_string($table)) {
            return $this->processTableName($table, $context);
        } else {
            return $this->processSubQuery($table, $context);
        }
    }
750634
public function addOrderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true);
    }
1148044
public final function setOrderData(Order $order)
    {
        if (get_called_class() != self::class) {
            throw new \InvalidArgumentException("Method can be call only by OrderFinalized entity");
        }
        $this->id = $order->id;
        $this->setProperties($order);
    }
82390
protected function process($context, $data)
	{
		// Make sure the given context is all uppercase.
		$context = strtoupper($context);

		// Ensure the given context is configured before processing.
		if(is_null($this->getConfiguration($context)))
		{
			return new Payload(null, strtolower($context . '_not_configured'));
		}

		//  Finally, process the data.
		return $this->processor->process($data, $this->getConfiguration($context)['keys'], $this->getConfiguration($context)['rules'], $this->getConfiguration($context)['defaults']);
	}
792644
public function process($context)
    {
        $context->setContents($this->setCDataPlaceholder($context->getContents(), $context->getPlaceholderContainer()));

        return $context->setContents($this->setConditionalCommentsPlaceholder($context->getContents(), $context->getPlaceholderContainer()));
    }
497100
function closeOrderContext (select) {
    // only operate if in order context
    if (select.context !== 'order') {
        return
    }
    // debug
    debug('closeOrderContext', select.contextData)
    // get columns to order by
    var columns = select.contextData.columns
    // must have columns in order to create order statement
    if (!Array.isArray(columns) || !columns.length) {
        // there is a direction with no column or there
        // are no order clauses in query then throw error
        if (!select.query.order || select.query.order.length === 0 || select.contextData.direction) {
            throwError('order must have columns', select)
        }
        // there is nothing in context that needs to be added to query
        else {
            return
        }
    }
    // if there is a direction then add to columns
    if (select.contextData.direction) {
        columns.push(select.contextData.direction)
    }
    // make sure query has order
    if (!select.query.order) {
        select.query.order = []
    }
    // add order caluse to query
    select.query.order.push(columns)
    // reset contextData
    select.contextData = {}
}
731978
public function sort($order = 'asc')
    {
        if ($order == 'desc') {
            rsort($this->_map);
        }else{
            sort($this->_map);
        }

        return $this;
    }