Changeset 1596
- Timestamp:
- 12/20/2007 04:34:46 PM (10 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/ORM.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/ORM.php
r1589 r1596 106 106 { 107 107 // Query and load object 108 $this->find($id );108 $this->find($id, FALSE); 109 109 } 110 110 } … … 449 449 * Find and load data for the current object. 450 450 * 451 * @param string id of the object to find, or ALL 452 * @return object current object 453 * @return array if ALL is used 454 */ 455 public function find($id = FALSE) 451 * @param string id of the object to find, or ALL 452 * @param boolean return the result, or load it into the current object 453 * @return object object instance 454 * @return array if ALL is used 455 */ 456 public function find($id = FALSE, $return = TRUE) 456 457 { 457 458 // Allows the use of find(ALL) … … 466 467 467 468 // Load the result of the query 468 return $this->load_result(FALSE );469 return $this->load_result(FALSE, $return); 469 470 } 470 471 … … 477 478 { 478 479 // Return an array of objects 479 return $this->load_result(TRUE );480 return $this->load_result(TRUE, TRUE); 480 481 } 481 482 … … 631 632 * array - Multiple row result set 632 633 */ 633 protected function load_result($array = FALSE )634 protected function load_result($array = FALSE, $return = FALSE) 634 635 { 635 636 // Make sure there is something to select … … 663 664 else 664 665 { 665 // Fetch the first result 666 if ($return === TRUE) 667 { 668 // Return the first result 669 return ORM::instance($this->class, $result->current()); 670 } 671 672 // Load the first result 666 673 $this->object = $result->current(); 667 674 }
