/** * Set an attribute of the object * * @see \ActiveRecord\Model::__set() * @param string $name * @param mixed $value The value of the field * @return mixed */ public function __set($name, $value) { // Camelize the name $camelized_name = Inflector::instance()->camelize($name); // Check for setter if (method_exists($this, "set_{$name}")) { $name = "set_{$name}"; return $this->{$name}($value); } elseif (method_exists($this, "set{$camelized_name}")) { $name = "set{$camelized_name}"; return $this->{$name}($value); } // Otherwise, just use our parent's magic setter return parent::__set($name, $value); }