/**
  * Sets a field
  * (also updates the db row on the end of the script)
  *
  * @param string $varname
  * @param mixed $value
  *
  * @see http://www.php.net/manual/en/language.oop5.overloading.php#object.set
  * @since ADD MVC 0.0
  */
 public function __set($varname, $value)
 {
     $validation_result = static::validate_field($varname, $value);
     if ($validation_result instanceof Exception) {
         throw $validation_result;
     }
     $previous_value = $this->data[$varname];
     parent::__set($varname, $value);
     if ($previous_value != $value) {
         $this->updated_data[$varname] = $value;
     }
 }
 public function __set($varname, $value)
 {
     $set = (bool) parent::__set($varname, $value);
     $updated = (bool) ($this->data[$varname] = $value);
     return $set && $updated;
 }