Pheasant\DomainObject::load PHP Method

load() public method

Loads an array of values into the object
public load ( $array, $filter = false )
$filter only processes the keys listed, or false for all
    public function load($array, $filter = false)
    {
        // apply the optional filter
        if (is_array($filter)) {
            $array = array_intersect_key($array, array_fill_keys($filter, NULL));
        }
        foreach ($array as $key => $value) {
            if (is_object($value) || is_array($value)) {
                $this->{$key} = $value;
            } else {
                $this->set($key, $value);
            }
        }
        return $this;
    }