Exemplo n.º 1
0
 private function update_record()
 {
     if ($this->is_frozen() || $this->is_read_only()) {
         return false;
     }
     if (!$this->is_dirty()) {
         return true;
     }
     if (!$this->run_callback('before_update')) {
         return false;
     }
     $this->touch_date_attributes('updated_at', 'updated_on');
     $quoted_attributes = $this->get_attributes_with_quotes();
     if (!empty($quoted_attributes)) {
         $result = self::$connection->update('UPDATE ' . $this->get_quoted_table_name() . ' ' . 'SET ' . SqlBuilder::quoted_comma_pair_list($quoted_attributes) . ' ' . 'WHERE ' . self::$connection->quote_column_name($this->primary_key()) . ' = ' . $this->get_quoted_attribute($this->primary_key()));
     }
     $this->run_callback('after_update');
     return $result;
 }