| @@ 273-296 (lines=24) @@ | ||
| 270 | * otherwise return "false". |
|
| 271 | * </p> |
|
| 272 | */ |
|
| 273 | public function fetch($id = null) |
|
| 274 | { |
|
| 275 | if ($id) { |
|
| 276 | $this->reset()->eq($this->primaryKeyName, $id); |
|
| 277 | } |
|
| 278 | ||
| 279 | return self::query( |
|
| 280 | $this->limit(1)->_buildSql( |
|
| 281 | array( |
|
| 282 | 'select', |
|
| 283 | 'from', |
|
| 284 | 'join', |
|
| 285 | 'where', |
|
| 286 | 'group', |
|
| 287 | 'having', |
|
| 288 | 'order', |
|
| 289 | 'limit', |
|
| 290 | ) |
|
| 291 | ), |
|
| 292 | $this->params, |
|
| 293 | $this->reset(), |
|
| 294 | true |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | ||
| 298 | /** |
|
| 299 | * @param string $query |
|
| @@ 441-463 (lines=23) @@ | ||
| 438 | * |
|
| 439 | * @return $this[] |
|
| 440 | */ |
|
| 441 | public function fetchAll(array $ids = null) |
|
| 442 | { |
|
| 443 | if ($ids) { |
|
| 444 | $this->reset()->in($this->primaryKeyName, $ids); |
|
| 445 | } |
|
| 446 | ||
| 447 | return self::query( |
|
| 448 | $this->_buildSql( |
|
| 449 | array( |
|
| 450 | 'select', |
|
| 451 | 'from', |
|
| 452 | 'join', |
|
| 453 | 'where', |
|
| 454 | 'group', |
|
| 455 | 'having', |
|
| 456 | 'order', |
|
| 457 | 'limit', |
|
| 458 | ) |
|
| 459 | ), |
|
| 460 | $this->params, |
|
| 461 | $this->reset() |
|
| 462 | ); |
|
| 463 | } |
|
| 464 | ||
| 465 | /** |
|
| 466 | * Function to delete current record in database. |
|