Changeset 3133

Show
Ignore:
Timestamp:
04/27/08 11:33:27 (2 months ago)
Author:
pmjones
Message:

Solar_Sql_Model_Record: [CHG] Method refresh() now attempts to refresh regardless of current status. Also, takes a param to set the status after refreshing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Solar/Sql/Model/Record.php

    r3123 r3133  
    896896     *  
    897897     */ 
    898     public function refresh() 
    899     { 
    900         if ($this->_status != 'new') { 
    901             $primary = $this->_model->primary_col; 
    902             $result = $this->_model->fetch($this->$primary); 
    903             $cols = $this->_model->table_cols; 
    904             foreach ($cols as $col => $info) { 
    905                 $this->$col = $result->$col; 
    906             } 
     898    public function refresh($status = null) 
     899    { 
     900        $primary = $this->_model->primary_col; 
     901        $result  = $this->_model->fetch($this->$primary); 
     902        foreach ($this->_model->table_cols as $col => $info) { 
     903            $this->$col = $result->$col; 
     904        } 
     905         
     906        if ($status) { 
     907            $this->setStatus($status) 
     908        } else { 
    907909            $this->setStatus('clean'); 
    908910        }