public function refreshFrom($values, $apiPublicKey, $apiPrivateKey, $partial = false) { $this->_apiPublicKey = $apiPublicKey; $this->_apiPrivateKey = $apiPrivateKey; if ($partial) { $removed = new TrustedSearch_Util_Set(); } else { $removed = array_diff(array_keys($this->_values), array_keys($values)); } foreach ($removed as $k) { if (self::$_permanentAttributes->includes($k)) { continue; } unset($this->{$k}); } foreach ($values as $k => $v) { if (self::$_permanentAttributes->includes($k)) { continue; } if (self::$_nestedUpdatableAttributes->includes($k) && is_array($v)) { $this->_values[$k] = TrustedSearch_Object::scopedConstructFrom('TrustedSearch_AttachedObject', $v, $apiPublicKey, $apiPrivateKey); } else { $this->_values[$k] = TrustedSearch_Util::convertToTrustedSearchObject($v, $apiPublicKey, $apiPrivateKey); } $this->_transientValues->discard($k); $this->_unsavedValues->discard($k); } }