コード例 #1
0
ファイル: Xml.php プロジェクト: btweedy/foresmo
 /**
  * 
  * Marks the struct and its parents as dirty.
  * 
  * @return void
  * 
  */
 protected function _setIsDirty()
 {
     // set this struct as dirty
     $this->_is_dirty = true;
     // set the parent struct as dirty too
     if ($this->_parent) {
         $this->_parent->_setIsDirty();
     }
 }
コード例 #2
0
ファイル: Params.php プロジェクト: btweedy/foresmo
 /**
  * 
  * Loads this params object with an array or struct.
  * 
  * @param array|Solar_Struct $spec The data to load.
  * 
  * @return Solar_Sql_Model_Params
  * 
  * @see _load()
  * 
  */
 public function load($spec)
 {
     parent::load($spec);
     return $this;
 }
コード例 #3
0
ファイル: Record.php プロジェクト: btweedy/foresmo
 /**
  * 
  * Initialize the record object.  This is effectively a "first load"
  * method.
  * 
  * @param Solar_Sql_Model $model The originating model object instance (a
  * dependency injection).
  * 
  * @param array $spec The data with which to initialize this record.
  * 
  * @return void
  * 
  */
 public function init(Solar_Sql_Model $model, $spec)
 {
     if ($this->_model) {
         throw $this->_exception('ERR_CANNOT_RE_INIT');
     }
     // inject the model
     $this->_model = $model;
     // sets access methods
     $this->_setAccessMethods();
     // force spec to array
     if ($spec instanceof Solar_Struct) {
         // we can do this because $spec is of the same class
         $load = $spec->_data;
     } elseif (is_array($spec)) {
         $load = $spec;
     } else {
         $load = array();
     }
     // unserialize any serialize_cols in the load
     $this->_model->unserializeCols($load);
     // Make sure changes to xml struct records cause us to be dirty
     foreach ($this->_model->xmlstruct_cols as $col) {
         if (!empty($load[$col])) {
             $load[$col]->setParent($this);
         }
     }
     // use parent load to push values directly into $_data array
     parent::load($load);
     // Record the inital values but only for columns that have physical backing
     $this->_initial = array_intersect_key($load, $model->table_cols);
     // placeholders for nonexistent calculate_cols, bypassing __set
     foreach ($this->_model->calculate_cols as $name => $info) {
         if (!array_key_exists($name, $this->_data)) {
             $this->_data[$name] = null;
         }
     }
     // fix up related data elements
     $this->_fixRelatedData();
     // new?
     $this->_is_new = false;
     // can't be invalid
     $this->_invalid = array();
     // can't be dirty
     $this->_is_dirty = false;
     // no last sql status
     $this->_sql_status = null;
 }
コード例 #4
0
ファイル: Iterator.php プロジェクト: kalkin/solarphp
 /**
  * 
  * Returns the struct value for the current iterator position.
  * 
  * @return mixed
  * 
  */
 public function current()
 {
     return $this->_struct->__get($this->key());
 }
コード例 #5
0
ファイル: Record.php プロジェクト: agentile/foresmo
 /**
  * 
  * Convenience method for getting a dump of the record, or one of its
  * properties, or an external variable.
  * 
  * @param mixed $var If null, dump $this; if a string, dump $this->$var;
  * otherwise, dump $var.
  * 
  * @param string $label Label the dump output with this string.
  * 
  * @return void
  * 
  */
 public function dump($var = null, $label = null)
 {
     if ($var) {
         return parent::dump($var, $label);
     }
     $clone = clone $this;
     unset($clone->_model);
     parent::dump($clone, $label);
 }