Пример #1
0
 /**
  * 
  * Returns a record from the collection based on its key value.  Converts
  * the stored data array to a record of the correct class on-the-fly.
  * 
  * @param int|string $key The sequential or associative key value for the
  * record.
  * 
  * @return Solar_Sql_Model_Record
  * 
  */
 public function __get($key)
 {
     if (!$this->__isset($key)) {
         // create a new blank record for the missing key
         $this->_data[$key] = $this->_model->fetchNew();
     }
     // convert array to record object.
     // honors single-table inheritance.
     if (is_array($this->_data[$key])) {
         // convert the data array to an object.
         // get the main data to load to the record.
         $load = $this->_data[$key];
         // done
         $this->_data[$key] = $this->_model->newRecord($load);
     }
     // return the record
     return $this->_data[$key];
 }