src/Titon/Model/Model.php
public function set($key, $value = null) {

        // Do not trigger state changes for relations
        if (!$this->hasRelation($key)) {

            // Only flag changed if the value is different
            if ($value != $this->get($key) && !in_array($key, $this->reserved)) {
                $this->_changed = true;
            }

            // Run the value through a mutator but do not set the mutator key
            if ($method = $this->hasMutator($key)) {
                $this->{$method}($value);

                return $this;
            }
        }

        $this->_attributes[$key] = $value;

        return $this;
    }
public function set($key, $value = null) {

        // Do not trigger state changes for relations
        if (!$this->hasRelation($key)) {

            // Only flag changed if the value is different
            if ($value != $this->get($key) && !in_array($key, $this->reserved)) {
                $this->_changed = true;
            }

            // Run the value through a mutator but do not set the mutator key
            if ($method = $this->hasMutator($key)) {
                $this->{$method}($value);

                return $this;
            }
        }

        $this->_attributes[$key] = $value;

        return $this;
    }
public function set ( $ key , $ value = null ) { // Do not trigger state changes for relations if ( ! $ this -> hasRelation ( $ key ) ) { // Only flag changed if the value is different if ( $ value != $ this -> get ( $ key ) && ! in_array ( $ key , $ this -> reserved ) ) { $ this -> _changed = true ; } // Run the value through a mutator but do not set the mutator key if ( $ method = $ this -> hasMutator ( $ key ) ) { $ this -> { $ method } ( $ value ) ; return $ this ; } } $ this -> _attributes [ $ key ] = $ value ; return $ this ; }
Set an attribute defined by key. If the key does not point to a relation,
pass the value through a mutator and set a changed flag.

@param string $key
@param mixed $value
@return $this
Set an attribute defined by key . If the key does not point to a relation pass the value through a mutator and set a changed flag .