Changeset 2299
- Timestamp:
- 03/13/2008 01:53:08 AM (8 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/ORM.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/ORM.php
r2280 r2299 32 32 protected $select = FALSE; 33 33 protected $where = FALSE; 34 protected $from = FALSE; 34 35 35 36 // Currently loaded object … … 233 234 if (preg_match('/^(has|add|remove)_(.+)/', $method, $matches)) 234 235 { 236 if (empty($this->object->id)) 237 { 238 // many<>many relationships only work when the object has been saved 239 return FALSE; 240 } 241 235 242 // Make a has/add/remove call 236 243 return $this->call_has_add_remove($method, $args, $matches); … … 247 254 $this->select = TRUE; 248 255 } 249 elseif (preg_match('/where|like| regex/', $method))256 elseif (preg_match('/where|like|in|regex/', $method)) 250 257 { 251 258 $this->where = TRUE; 259 } 260 elseif ($method === 'from') 261 { 262 $this->from = TRUE; 252 263 } 253 264 … … 703 714 // Reset object status 704 715 $this->changed = array(); 705 $this->select = FALSE; 706 $this->where = FALSE; 716 $this->select = $this->where = $this->from = FALSE; 707 717 708 718 return $this; … … 738 748 $this->select or self::$db->select($this->table.'.*'); 739 749 750 // Make sure there is a table to select from 751 $this->from or self::$db->from($this->table); 752 740 753 // Fetch the query result 741 $result = self::$db->get( $this->table)->result(TRUE);754 $result = self::$db->get()->result(TRUE); 742 755 743 756 if ($array === TRUE) … … 771 784 // Clear the changed keys, a new object has been loaded 772 785 $this->changed = array(); 773 $this->select = FALSE; 774 $this->where = FALSE; 786 $this->select = $this->where = $this->from = FALSE; 775 787 776 788 // Return this object
