| @@ 281-304 (lines=24) @@ | ||
| 278 | * otherwise return "false". |
|
| 279 | * </p> |
|
| 280 | */ |
|
| 281 | public function fetch($id = null) |
|
| 282 | { |
|
| 283 | if ($id) { |
|
| 284 | $this->reset()->eq($this->primaryKeyName, $id); |
|
| 285 | } |
|
| 286 | ||
| 287 | return self::query( |
|
| 288 | $this->limit(1)->_buildSql( |
|
| 289 | array( |
|
| 290 | 'select', |
|
| 291 | 'from', |
|
| 292 | 'join', |
|
| 293 | 'where', |
|
| 294 | 'group', |
|
| 295 | 'having', |
|
| 296 | 'order', |
|
| 297 | 'limit', |
|
| 298 | ) |
|
| 299 | ), |
|
| 300 | $this->params, |
|
| 301 | $this->reset(), |
|
| 302 | true |
|
| 303 | ); |
|
| 304 | } |
|
| 305 | ||
| 306 | /** |
|
| 307 | * @param string $query |
|
| @@ 449-471 (lines=23) @@ | ||
| 446 | * |
|
| 447 | * @return $this[] |
|
| 448 | */ |
|
| 449 | public function fetchAll(array $ids = null) |
|
| 450 | { |
|
| 451 | if ($ids) { |
|
| 452 | $this->reset()->in($this->primaryKeyName, $ids); |
|
| 453 | } |
|
| 454 | ||
| 455 | return self::query( |
|
| 456 | $this->_buildSql( |
|
| 457 | array( |
|
| 458 | 'select', |
|
| 459 | 'from', |
|
| 460 | 'join', |
|
| 461 | 'where', |
|
| 462 | 'groupBy', |
|
| 463 | 'having', |
|
| 464 | 'orderBy', |
|
| 465 | 'limit', |
|
| 466 | ) |
|
| 467 | ), |
|
| 468 | $this->params, |
|
| 469 | $this->reset() |
|
| 470 | ); |
|
| 471 | } |
|
| 472 | ||
| 473 | /** |
|
| 474 | * Function to delete current record in database. |
|