| @@ 285-299 (lines=15) @@ | ||
| 282 | * @return array |
|
| 283 | * @throws \Exception |
|
| 284 | */ |
|
| 285 | public function all() |
|
| 286 | { |
|
| 287 | if (!$this->statement) { |
|
| 288 | $this->execute(); |
|
| 289 | } |
|
| 290 | ||
| 291 | if ($this->model && class_exists($this->model)) { |
|
| 292 | $dataModel = array(); |
|
| 293 | while ($data = $this->statement->fetch()) { |
|
| 294 | $dataModel[] = new $this->model($data, false); |
|
| 295 | } |
|
| 296 | return $dataModel; |
|
| 297 | } |
|
| 298 | return $this->statement->fetchAll(); |
|
| 299 | } |
|
| 300 | ||
| 301 | /** |
|
| 302 | * @return mixed |
|
| @@ 305-317 (lines=13) @@ | ||
| 302 | * @return mixed |
|
| 303 | * @throws \Exception |
|
| 304 | */ |
|
| 305 | public function get() |
|
| 306 | { |
|
| 307 | if (!$this->statement) { |
|
| 308 | $this->execute(); |
|
| 309 | } |
|
| 310 | ||
| 311 | if ($this->model && class_exists($this->model)) { |
|
| 312 | $data = $this->statement->fetch(); |
|
| 313 | return $data?new $this->model($data, false):$data; |
|
| 314 | } |
|
| 315 | ||
| 316 | return $this->statement->fetch(); |
|
| 317 | } |
|
| 318 | ||
| 319 | /** |
|
| 320 | * Clear statement PDO and query builder |
|