src/Model.php
public function hydrate($data, $removePrimaryKey = false)
    {
        foreach ($data as $key => $value) {
            if (property_exists($this, $key)) {
                $this->$key = $value;
            } else {
                $this->extra[$key] = $value;
            }
        }
        if ($removePrimaryKey) {
            $key = $this->getPrimaryKey();
            $this->$key = null;
        }
        return $this;
    }
public function hydrate($data, $removePrimaryKey = false)
    {
        foreach ($data as $key => $value) {
            if (property_exists($this, $key)) {
                $this->$key = $value;
            } else {
                $this->extra[$key] = $value;
            }
        }
        if ($removePrimaryKey) {
            $key = $this->getPrimaryKey();
            $this->$key = null;
        }
        return $this;
    }
public function hydrate ( $ data , $ removePrimaryKey = false ) { foreach ( $ data as $ key => $ value ) { if ( property_exists ( $ this , $ key ) ) { $ this -> $ key = $ value ; } else { $ this -> extra [ $ key ] = $ value ; } } if ( $ removePrimaryKey ) { $ key = $ this -> getPrimaryKey ( ) ; $ this -> $ key = null ; } return $ this ; }
Sets the properties of this object using an associative array,
where key is the property name and value is the property value.

Properties that do not exist in the current context are ignored.

@param array $data             Associative array
@param bool  $removePrimaryKey Optional: If true, the primary key of the
model will be unset. This is useful for hydrating a new object
and the source ($_POST) erroneously supplies a primary key.

Default: false
@return static
Sets the properties of this object using an associative array where key is the property name and value is the property value .