public function setAttributes($attributes)
    {
        if (count($safe = static::getSafeAttributes($this->_action))) {
            foreach ($safe as $attribute) {
                if (isset($attributes[$attribute])) {
                    $this->$attribute = $attributes[$attribute];
                }
            }
            return $this;
        }
        foreach ($attributes as $name => $value) {
            $this->$name = $value;
        }
        return $this;
    }
public function setAttributes($attributes)
    {
        if (count($safe = static::getSafeAttributes($this->_action))) {
            foreach ($safe as $attribute) {
                if (isset($attributes[$attribute])) {
                    $this->$attribute = $attributes[$attribute];
                }
            }
            return $this;
        }
        foreach ($attributes as $name => $value) {
            $this->$name = $value;
        }
        return $this;
    }
public function setAttributes ( $ attributes ) { if ( count ( $ safe = static :: getSafeAttributes ( $ this -> _action ) ) ) { foreach ( $ safe as $ attribute ) { if ( isset ( $ attributes [ $ attribute ] ) ) { $ this -> $ attribute = $ attributes [ $ attribute ] ; } } return $ this ; } foreach ( $ attributes as $ name => $ value ) { $ this -> $ name = $ value ; } return $ this ; }
Set attributes in a safe way. it will check rules for safe attributes and it will ignore those that are not safe.
To be used on search, insert, update from web form to make sure that the user doesn't add extra fields to the form.
@param string [string] $attributes
@return $this
Set attributes in a safe way . it will check rules for safe attributes and it will ignore those that are not safe . To be used on search insert update from web form to make sure that the user doesn t add extra fields to the form .