Sets the list order direction

@param type $fields comma seperated list, or array
@param type $direction
@return \Platform\Entity
973724
final public function setListOrderBy($fields, $direction = "ASC")
    {

        $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' ' . $direction : ' ASC';
        $orderby = NULL;
        //Clean up the order by field list
        if (!empty($fields) && !is_array($fields)) {
            $temp = array();
            foreach (explode(',', $fields) as $part) {
                $part = trim($part);
                $temp[] = $part;
            }

            $orderby = implode(', ', $temp);
        } else if (is_array($fields)) {
            $temp = array();
            foreach ($fields as $field) {
                $part = trim($field);
                $temp[] = $part;
            }
            $orderby = implode(', ', $temp);
        }


        if (!empty($orderby)) {
            $this->listOrderByStatement = "\nORDER BY " . $orderby . $direction;
        }
        //Return this object
        return $this;
    }
110291
public function orderBy($key, $direction = \Parable\ORM\Query::ORDER_ASC)
    {
        $this->orderBy = ['key' => $key, 'direction' => $direction];
        return $this;
    }
1294824
public function orderBy($orderBy, $direction='asc')
    {
        if($direction == 'desc')
            return $this->model->orderBy($orderBy, 'desc');
        else
            return $this->model->orderBy($orderBy, 'asc');
    }
907535
public function desc($fields) {
        if (is_array($fields)) {
            $this->_order = ' ORDER BY ' . implode($fields, ', ') . ' DESC';
        } else {
            $this->_order = ' ORDER BY ' . $fields . ' DESC';
        }
         
        return $this;
    }
778586
public function order($columns, $direction = 'ASC')
    {
        foreach ((array) $columns as $column)
        {
            $this->order[] = array(
                'column'    => $column,
                'direction' => $direction
            );
        }

        return $this;
    }
207124
public function orderBy($key, $direction = 'ASC')
    {
        if (Helpers\Validate::table($this->name)->field($key))
        {
            $directions                        = array(
                'ASC'  => SORT_ASC,
                'DESC' => SORT_DESC
            );
            $this->pending[__FUNCTION__][$key] = isset($directions[$direction]) ? $directions[$direction] : 'ASC';
        }

        return $this;
    }
657780
public function setOrderBy(array $orderBy)
    {
        // Validate and force the case for the direction.
        foreach ($orderBy as $attribute => $direction) {
            if (!in_array(strtoupper($direction), self::ORDER)) {
                throw new \InvalidArgumentException(sprintf(
                    'Order direction "%s" is invalid. Valid values are ASC and DESC',
                    $direction
                ));
            }
            $orderBy[$attribute] = strtoupper($direction);
        }
        $this->orderBy = $orderBy;

        return $this;
    }
1141726
public function sort($key, $direction=CanSort::ASC)
    {
        $this->bootCanSortMethodsOnce();
        $this->sorting[$key] = $direction;
        return $this;
    }
539768
public function sort(array $fields)
	{
		$sortFields = [];
		foreach ($fields as $field => $value) {
			// Simplest form, just a field name.
			if (is_numeric($field) && !is_array($value)) {
				$sortFields[] = $value;
			} // Field with direction and/or other options.
			else {
				$sortFields[] = [$field => $value];
			}
		}

		$this->set('sort', $sortFields);

		return $this;
	}
1007894
public function setOrder($field, $desc = null)
    {
        if (!$field instanceof Field) {
            if (is_object($field)) {
                $this->_dsql()->order($field, $desc);

                return $this;
            }

            if (is_string($field) && strpos($field, ',') !== false) {
                $field = explode(',', $field);
            }
            if (is_array($field)) {
                if (!is_null($desc)) {
                    throw $this->exception('If first argument is array, second argument must not be used');
                }

                foreach (array_reverse($field) as $o) {
                    $this->setOrder($o);
                }

                return $this;
            }

            if (is_null($desc) && is_string($field) && strpos($field, ' ') !== false) {
                list($field, $desc) = array_map('trim', explode(' ', trim($field), 2));
            }

            /** @type Field $field */
            $field = $this->getElement($field);
        }

        $this->_dsql()->order($field, $desc);

        return $this;
    }
854639
public function orderBy($field, $direction = 'asc')
    {
        $this->sort = $field;
        $this->sortDirection = $direction;

        return $this;
    }
260545
public function order_by($property, $direction = 'ASC')
	{
		if (is_array($property))
		{
			foreach ($property as $p => $d)
			{
				if (is_int($p))
				{
					is_array($d) ? $this->order_by($d[0], $d[1]) : $this->order_by($d, $direction);
				}
				else
				{
					$this->order_by($p, $d);
				}
			}
			return $this;
		}

		// prefix table alias when not yet prefixed and not a DB expression object
		if ( ! $property instanceof \Fuel\Core\Database_Expression and strpos($property, '.') === false)
		{
			$property = $this->alias.'.'.$property;
		}

		$this->order_by[] = array($property, $direction);

		return $this;
	}
493180
public function sortBy($field, $direction = 'asc', $flags = null)
    {
        $this->sortByField = $field;

        // Normalize direction.
        $direction = strtolower($direction);

        if ($direction === 'asc' || $direction === 'desc') {
            $this->sortByDirection = $direction;
        }

        if (is_null($flags)) {
            $this->sortByFlags = SORT_NATURAL + SORT_FLAG_CASE;
        }

        return $this;
    }
1364707
public function sort($index, $direction)
    {
        if (!in_array($direction, ['ASC', 'DESC'])) {
            throw new CollectionException('Sort direction must be ASC or DESC.');
        }

        $this->_sort = ['index' => $index, 'dir' => $direction];
        return $this;
    }
1110059
public function orderBy($index, $direction = 'desc')
    {
        if ($direction != 'desc') {
            $direction = 'asc';
        }

        if (is_array($index)) {
            $this->attributes['order'][] = $index;
        } else {
            $this->attributes['order'][] = [$index, $direction];
        }

        return $this;
    }
1098755
final public function orderBy(string $memberExpression, string $direction)
    {
        $this->orderings[] = new MemberOrdering(
            $this->memberExpressionParser->parse($this->class, $memberExpression),
            $direction
        );

        return $this;
    }
75621
public function orderBy($field, $direction = 1)
    {
        if (is_string($direction)) {
            $direction = $direction === 'asc' ? 1 : -1;
        }

        $this->orderBy[$field] = $direction;

        return $this;
    }