Updates the user preferences for a given key and data.

@param  string $key
@param  mixed $data

@return self
767854
public function update(string $key, $data)
	{
		if (is_string($data)) {
			$data = $this->normalizeToCollection($data);
		}

		if ($this->allowed->has($key)) {
			$this->updatePreferencesForKey(
				$key, $this->normalizedTags($data)
			);

			$this->updateCategories(
				$data->pluck('category_id')->unique()
			);
		}

		return $this;
	}
732390
public function setSubmitted($key, $data)
    {
        if (isset($key)) {
            gplcart_array_set($this->submitted, $key, $data);
            return $this->submitted;
        }

        return $this->submitted = (array) $data;
    }
941850
public function appendData($key, $data)
    {
        $this->_putData($key, $data);

        if ($this->_objectCreation) {
            return $this->_afterAppendDataToNewObject();
        }
        return $this;
    }
151797
protected function updatePreferencesForKey(string $key, Collection $tags)
	{
		$tags = str_replace('"', '', $tags->implode(','));

		$tags = Collection::make(explode(',', $tags))
			->merge(explode(',',$this->preferences[$key]))
			->unique()
			->take(self::MAX_TAGS)
			->implode(',');

		$this->preferences[$key] = rtrim($tags, ',');
	}
1063485
public function update($key, $data = null)
    {
        //1. Check if we have data and deal with it!
        if (!is_null($data)) {
            if (!$this->bindData($data)) {
                //we could not save the data
                return false;
            }
        }
    }
771973
public function remove($key)
    {
        if (isset($this->_data[$key])) {
            unset($this->_data[$key]);
        }

        return $this;
    }
388446
public function setData($key, $value){

        $key = $this->normalizeKeyName($key);

        if( isset($this->_data[$key]) ){
            if( $this->_data[$key] !== $value ){
                $this->_original[$key] = $this->_data[$key];
                $this->_changes[$key] = $value;
            }
        }else{
            $this->_changes[$key] = $value;
        }

        $this->_data[$key] = $value;

        return $this;
    }
1307190
public function Preference($Key = FALSE) {
      $this->Permission('Garden.SignIn.Allow');
      
      $this->Form->InputPrefix = '';
      
      if ($this->Form->IsPostBack()) {
         $Data = $this->Form->FormValues();
         Gdn::UserModel()->SavePreference(Gdn::Session()->UserID, $Data);
      } else {
         $User = Gdn::UserModel()->GetID(Gdn::Session()->UserID, DATASET_TYPE_ARRAY);
         $Pref = GetValueR($Key, $User['Preferences'], NULL);
         
         $this->SetData($Key, $Pref);
      }
      
      $this->Render('Blank', 'Utility');
   }
392517
public function delete($key)
    {
        key_exists_or_fail($key, $this->data);
        unset($this->data[$key]);
        $this->data = array_values($this->data);

        return $this;
    }
1277173
public function update(array $data, $primaryKey)
    {
        $this->normalizeDataColumns($data);

        $this->setSearchIndexableData($data);

        return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]);
    }
23730
public function setTemplate(array $data, string $key): void
  {
    $this->templateData = $data;
    $this->templateKey  = $key;
  }
700454
public static function insert($key, $data)
    {
        if (self::$configurator instanceof ConfiguratorClass) {
            return self::$configurator->insert($key, $data);
        } else {
            return null;
        }
    }
936030
public function updateAction($key, $value)
    {
        // TODO: This should be done in an earlier stage (TypeConverter ?)
        if (strtolower($value) === 'false') {
            $value = false;
        } elseif (strtolower($value) === 'true') {
            $value = true;
        }

        $user = $this->userService->getCurrentUser();
        $user->getPreferences()->set($key, $value);
        $this->userService->updateUser($user);
        $this->throwStatus(204, 'User preferences have been updated');
    }
1307603
function(key, data) {
        var currentData;
        currentData = settings[key] || {};
        settings[key] = _.extend(currentData, data);
      }
614161
public function putData($key, $data)
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('The session has not been started yet.', 1218034661);
        }
        $this->data[$key] = $data;
    }
1074148
public function add($key, $data)
    {
        $toInsert = $this->getDocumentData($data);

        $result = $this->collection->insertOne($toInsert);

        $data->_id = $result->getInsertedId();
    }
1243943
public function add($key, $data)
    {
        $this->validate($key, $data);

        $this->injectedData[$key] = $data;
    }