Changeset 2312
- Timestamp:
- 03/17/2008 10:01:21 AM (10 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/ORM.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/ORM.php
r2311 r2312 556 556 return $this->find_all(); 557 557 558 // To allow the object to be reloaded 559 ($id === TRUE) and $id = $this->id; 560 558 561 // Generate WHERE 559 562 if ($this->where === FALSE AND ! empty($id)) 560 563 { 561 if ($id === TRUE) 562 { 563 self::$db->where($this->object->id); 564 } 565 elseif (is_array($id)) 564 if (is_array($id)) 566 565 { 567 566 self::$db->where($id); … … 609 608 } 610 609 611 if ( $this->object->id == '')610 if (empty($this->object->id)) 612 611 { 613 612 // Perform an insert 614 613 $query = self::$db->insert($this->table, $data); 615 614 616 if ($query->count() === 1)615 if ($query->count()) 617 616 { 618 617 // Set current object id by the insert id … … 626 625 } 627 626 628 if ($query->count() === 1)627 if ($query->count()) 629 628 { 630 629 // Reset changed data 631 630 $this->changed = array(); 631 632 // Reset SELECT, WHERE, and FROM 633 $this->select = $this->where = $this->from = FALSE; 632 634 633 635 return TRUE;
