select = $select; $this->callback = $callback; } public function order($field, $direction = null) { if ($this->callback !== null) { $field = call_user_func($this->callback, $field) ?: $field; } if ($direction === null) { $this->select->orderBy($field); } else { $this->select->orderBy($field, $direction); } } public function hasOrder() { return $this->select->hasOrderBy(); } public function getOrder() { return $this->select->getOrderBy(); } }