Sprig_Core::__unset PHP Method

__unset() public method

Unset the changed the value of a field.
public __unset ( $name ) : void
return void
    public function __unset($name)
    {
        if (!$this->_init) {
            // The constructor must always be called first
            $this->__construct();
        }
        if (!isset($this->_fields[$name])) {
            throw new Sprig_Exception(':name model does not have a field :field', array(':name' => get_class($this), ':field' => $name));
        }
        $field = $this->_fields[$name];
        if ($field->in_db) {
            // Set the original value back to the default
            $this->_original[$name] = $field->value($field->default);
        }
        // Remove any changed value
        unset($this->_changed[$name]);
    }