コード例 #1
0
ファイル: MingoOrm.php プロジェクト: Jaymon/Mingo
 /**
  * I'm slowly moving this to one orm represents one row, sadly, there is still
  * a lot code that needs to be changed/updated, this should be used over attach()
  * for replacing the internal contents of an orm
  *
  * @since 2013-3-7
  * @param array $map  the fields you want to set into the orm
  */
 public function setFields(array $field_map)
 {
     $this->reset();
     $this->is_modified = true;
     parent::setFields($field_map);
     return $this;
 }
コード例 #2
0
ファイル: MingoTable.php プロジェクト: Jaymon/Mingo
 /**
  *  get a field instance for the given name
  *  
  *  this will return any previously set field instance if it exists, if it doesn't
  *  then it will create a new one so it guarrantees to always return an mingo_field
  *  instance         
  *
  *  @param  string|array  $name the field's name   
  *  @return mingo_field
  */
 public function getField($name, $default_val = null)
 {
     $ret_instance = parent::getField($name, null);
     if ($ret_instance === null) {
         $ret_instance = new MingoField($name);
         $ret_instance->setDefaultVal($default_val);
     }
     //if
     return $ret_instance;
 }