Beispiel #1
0
 function update()
 {
     $this->call_action("update_before");
     $this->Validate('update');
     $identifying = $this->getIdentifyingSQL();
     $values = $this->toSQL();
     foreach ($identifying as $k => $v) {
         if (isset($values[$k]) && $values[$k] == $v) {
             unset($values[$k]);
         }
     }
     foreach ($values as $k => $v) {
         $mapped = $this->orm->mappings[$k];
         if (!isset($this->_store[$mapped])) {
             if ($v === null) {
                 unset($values[$k]);
             }
         } elseif ((string) $v == $this->_store[$mapped]) {
             unset($values[$k]);
         }
     }
     if (count($values)) {
         $this->call_action("update_before_query");
         \Radical\DB::Update($this->orm->tableInfo['name'], $values, $identifying);
     }
     $this->call_action("update_after");
 }