public function set($name, $value = UNDEFINED)
    {
        if (is_array($name)) {
            foreach ($name as $key => $val) {
                $this->set($key, $val);
            }

            return $this;
        } elseif ($value === UNDEFINED) {
            throw $this->exception('You must define the second argument');
        }

        if ($this->strict_fields && !$this->hasElement($name)) {
            throw $this->exception('No such field', 'Logic')
                ->addMoreInfo('field', $name);
        }

        if (($value !== $this->data[$name]) || (is_null($value) && !array_key_exists($name, $this->data))) {
            $this->data[$name] = $value;
            $this->setDirty($name);
        }

        if ($name === $this->id_field) {
            $this->id = $value;
        }

        return $this;
    }
public function set($name, $value = UNDEFINED)
    {
        if (is_array($name)) {
            foreach ($name as $key => $val) {
                $this->set($key, $val);
            }

            return $this;
        } elseif ($value === UNDEFINED) {
            throw $this->exception('You must define the second argument');
        }

        if ($this->strict_fields && !$this->hasElement($name)) {
            throw $this->exception('No such field', 'Logic')
                ->addMoreInfo('field', $name);
        }

        if (($value !== $this->data[$name]) || (is_null($value) && !array_key_exists($name, $this->data))) {
            $this->data[$name] = $value;
            $this->setDirty($name);
        }

        if ($name === $this->id_field) {
            $this->id = $value;
        }

        return $this;
    }
public function set ( $ name , $ value = UNDEFINED ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ key => $ val ) { $ this -> set ( $ key , $ val ) ; } return $ this ; } elseif ( $ value === UNDEFINED ) { throw $ this -> exception ( 'You must define the second argument' ) ; } if ( $ this -> strict_fields && ! $ this -> hasElement ( $ name ) ) { throw $ this -> exception ( 'No such field' , 'Logic' ) -> addMoreInfo ( 'field' , $ name ) ; } if ( ( $ value !== $ this -> data [ $ name ] ) || ( is_null ( $ value ) && ! array_key_exists ( $ name , $ this -> data ) ) ) { $ this -> data [ $ name ] = $ value ; $ this -> setDirty ( $ name ) ; } if ( $ name === $ this -> id_field ) { $ this -> id = $ value ; } return $ this ; }
Set value of fields. If only a single argument is specified
and it is a hash, will use keys as property names and set values
accordingly.

@param $name array or string
@param $value null or value

@return $this
Set value of fields . If only a single argument is specified and it is a hash will use keys as property names and set values accordingly .