[Solar-svn] Revision 3208

pmjones at solarphp.com pmjones at solarphp.com
Mon Jun 9 17:51:05 CDT 2008


Solar_Sql_Model_Record: [CHG] In method refresh(), throw an exception instead of failing silently when the record cannot be refreshed due to a missing ID.


Modified: trunk/Solar/Sql/Model/Record.php
===================================================================
--- trunk/Solar/Sql/Model/Record.php	2008-06-09 22:49:23 UTC (rev 3207)
+++ trunk/Solar/Sql/Model/Record.php	2008-06-09 22:51:04 UTC (rev 3208)
@@ -904,7 +904,12 @@
     public function refresh($status = null)
     {
         $primary = $this->_model->primary_col;
-        $result  = $this->_model->fetch($this->$primary);
+        $id = $this->$primary;
+        if (! $id) {
+            throw $this->_exception("ERR_CANNOT_REFRESH_BLANK_ID");
+        }
+        
+        $result = $this->_model->fetch($id);
         foreach ($this->_model->table_cols as $col => $info) {
             $this->$col = $result->$col;
         }




More information about the Solar-svn mailing list