예제 #1
0
 /**
  * Saves a new record or Updates an already created one.
  *
  * @return [[Type]] [[Description]]
  */
 public function save()
 {
     //Initialize parameters
     static::initialize();
     //Check if Update or Insert is needeed and run required query
     if (isset($this->id)) {
         $result = SQLQuery::update(static::$tableName, static::$DBH, $this);
     } else {
         $result = SQLQuery::insert(static::$tableName, static::$DBH, $this);
     }
     //Return result
     return $result;
 }