}
}
+ /**
+ * Sets an array of data into the API, ignoring things in $exclude. Keys
+ * in the array that don't exist in the API will be ignored.
+ *
+ * @param array A dictionary of field names and values to set
+ * @param array Array of keys to exclude
+ */
+ public function setArray(Array $data, $exclude = array())
+ {
+ foreach ($data as $key => $value)
+ {
+ if (in_array($key, $exclude) || !isset($this->fields[$key]))
+ {
+ continue;
+ }
+ $this->set($key, $value);
+ }
+ }
+
/**
* Sets a value, sanitizes it, and validates it
*