| @@ 131-145 (lines=15) @@ | ||
| 128 | * |
|
| 129 | * @throws LogicException |
|
| 130 | */ |
|
| 131 | public function orderBy($order) |
|
| 132 | { |
|
| 133 | if (!isset($this->query)) { |
|
| 134 | throw new LogicException("orderBy() called before select()"); |
|
| 135 | } |
|
| 136 | ||
| 137 | if (!is_array($order)) { |
|
| 138 | $order = [$order]; |
|
| 139 | } |
|
| 140 | ||
| 141 | $query = clone $this->query; |
|
| 142 | $query->orderBy($order); |
|
| 143 | ||
| 144 | return $this->cloneWith("query", $query); |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * @param mixed $where |
|
| @@ 173-188 (lines=16) @@ | ||
| 170 | * |
|
| 171 | * @throws LogicException |
|
| 172 | */ |
|
| 173 | public function select($columns = "*") |
|
| 174 | { |
|
| 175 | if (!isset($this->table)) { |
|
| 176 | throw new LogicException("select() called before table()"); |
|
| 177 | } |
|
| 178 | ||
| 179 | if (!is_array($columns)) { |
|
| 180 | $columns = [$columns]; |
|
| 181 | } |
|
| 182 | ||
| 183 | $query = $this->factory->newSelect(); |
|
| 184 | $query->from($this->table); |
|
| 185 | $query->cols($columns); |
|
| 186 | ||
| 187 | return $this->cloneWith("query", $query); |
|
| 188 | } |
|
| 189 | ||
| 190 | /** |
|
| 191 | * @param string $table |
|