@@ 964-979 (lines=16) @@ | ||
961 | * @param bool $overwrite whether to reset order with field list or not |
|
962 | * @return $this |
|
963 | */ |
|
964 | public function order($fields, $overwrite = false) |
|
965 | { |
|
966 | if ($overwrite) { |
|
967 | $this->_parts['order'] = null; |
|
968 | } |
|
969 | ||
970 | if (!$fields) { |
|
971 | return $this; |
|
972 | } |
|
973 | ||
974 | if (!$this->_parts['order']) { |
|
975 | $this->_parts['order'] = new OrderByExpression(); |
|
976 | } |
|
977 | $this->_conjugate('order', $fields, '', []); |
|
978 | return $this; |
|
979 | } |
|
980 | ||
981 | /** |
|
982 | * Add an ORDER BY clause with an ASC direction. |
|
@@ 991-1005 (lines=15) @@ | ||
988 | * @param bool $overwrite Whether or not to reset the order clauses. |
|
989 | * @return $this |
|
990 | */ |
|
991 | public function orderAsc($field, $overwrite = false) |
|
992 | { |
|
993 | if ($overwrite) { |
|
994 | $this->_parts['order'] = null; |
|
995 | } |
|
996 | if (!$field) { |
|
997 | return $this; |
|
998 | } |
|
999 | ||
1000 | if (!$this->_parts['order']) { |
|
1001 | $this->_parts['order'] = new OrderByExpression(); |
|
1002 | } |
|
1003 | $this->_parts['order']->add(new OrderClauseExpression($field, 'ASC')); |
|
1004 | return $this; |
|
1005 | } |
|
1006 | ||
1007 | /** |
|
1008 | * Add an ORDER BY clause with an ASC direction. |
|
@@ 1017-1031 (lines=15) @@ | ||
1014 | * @param bool $overwrite Whether or not to reset the order clauses. |
|
1015 | * @return $this |
|
1016 | */ |
|
1017 | public function orderDesc($field, $overwrite = false) |
|
1018 | { |
|
1019 | if ($overwrite) { |
|
1020 | $this->_parts['order'] = null; |
|
1021 | } |
|
1022 | if (!$field) { |
|
1023 | return $this; |
|
1024 | } |
|
1025 | ||
1026 | if (!$this->_parts['order']) { |
|
1027 | $this->_parts['order'] = new OrderByExpression(); |
|
1028 | } |
|
1029 | $this->_parts['order']->add(new OrderClauseExpression($field, 'DESC')); |
|
1030 | return $this; |
|
1031 | } |
|
1032 | ||
1033 | /** |
|
1034 | * Adds a single or multiple fields to be used in the GROUP BY clause for this query. |