/** * Set the ORDER BY clause of this query * * @see SQLSelect::orderby() * * @param String $sort Column to sort on (escaped SQL statement) * @param String $direction Direction ("ASC" or "DESC", escaped SQL statement) * @param Boolean $clear Clear existing values * @return DataQuery */ public function sort($sort = null, $direction = null, $clear = true) { if ($clear) { $this->query->setOrderBy($sort, $direction); } else { $this->query->addOrderBy($sort, $direction); } return $this; }