FOF30\Model\DataModel::orderBy PHP Method

orderBy() public method

Alias of $this->setState('filter_order', $fieldName) and $this->setState('filter_order_Dir', $direction)
public orderBy ( string $fieldName, string $direction = 'ASC' )
$fieldName string The field name to order by
$direction string The direction to order by (ASC for ascending or DESC for descending)
    public function orderBy($fieldName, $direction = 'ASC')
    {
        $direction = strtoupper($direction);
        if (!in_array($direction, array('ASC', 'DESC'))) {
            $direction = 'ASC';
        }
        $this->setState('filter_order', $fieldName);
        $this->setState('filter_order_Dir', $direction);
        return $this;
    }