Updates $instance with $values
To eventually be redefined in derived classes

@param object $instance the instance to update
@param array|null $values
970131
protected function _setValuesToObject($instance, $values = null) {
		if (URequest::isJSON ()) {
			if(is_string($values)){
				$values = \json_decode ( $values, true );
			}
		}
		$className = \get_class ( $instance );
		$fieldsInRelationForUpdate = OrmUtils::getFieldsInRelationsForUpdate_ ( $className );
		$manyToOneRelations = $fieldsInRelationForUpdate ["manyToOne"];
		
		$members = array_keys ( $values );
		OrmUtils::setFieldToMemberNames ( $members, $fieldsInRelationForUpdate ["relations"] );
		URequest::setValuesToObject ( $instance, $values );
		if ($manyToOneRelations) {
			$this->updateManyToOne ( $manyToOneRelations, $members, $className, $instance, $values );
		}
	}
740158
protected static function setProperties($parser, $instance): void
    {
        $instance->malId = $parser->getMalId();
        $instance->url = $parser->getUrl();
        $instance->name = $parser->getName();
        $instance->imageUrl = $parser->getImage();
        $instance->role = $parser->getRole();
    }
177003
public function instance($abstract, $instance)
    {
        $abstract = $this->normalize($abstract);
        if (is_array($abstract)) {
            list($abstract, $alias) = $this->extractAlias($abstract);
            $this->alias($abstract, $alias);
        }
        unset($this->aliases[$abstract]);
        $bound = $this->bound($abstract);

        $this->instances[$abstract] = $instance;
        if ($bound) {
            $this->rebound($abstract);
        }
    }
1342712
public function updated($instance)
    {
        $before = $this->recordableAttributes(get_class($instance), $instance->getOriginal());

        $after = $this->recordableAttributes(get_class($instance), $instance->getAttributes());

        $instance->recordActivity('updated', $before, $after);
    }
1161212
public static function setInstance($instance)
    {
        if ($instance === null) {
            unset(Yii::getApp()->loadedModules[static::class]);
        } else {
            Yii::getApp()->loadedModules[\get_class($instance)] = $instance;
        }
    }
46268
public function setInstance(Instance $instance)
    {
        $this->instance = $instance;
        $this->exception = null;
        $this->connect();
        
        return $this;
    }
304544
public static function store($instance, $name = null)
    {
        if (!$name) {
            $name = get_class($instance);
        }
        $name = self::cleanName($name);
        self::$instances[$name] = $instance;
    }
1123495
public void updateInstance(
      Instance my_instance,
      final String my_client_project,
      final String my_instance_id,
      final String my_display_name) {
    // [START instance_admin_client_update_instance]
    Instance instance = my_instance;
    final String clientProject = my_client_project;
    final String instanceId = my_instance_id;

    final String newDisplayName = my_display_name;

    InstanceInfo toUpdate =
        InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
            .setDisplayName(newDisplayName)
            .setNodeCount(instance.getNodeCount() + 1)
            .build();
    // Only update display name
    OperationFuture<Instance, UpdateInstanceMetadata> op =
        instanceAdminClient.updateInstance(toUpdate, InstanceInfo.InstanceField.DISPLAY_NAME);
    try {
      op.get();
    } catch (ExecutionException e) {
      throw (SpannerException) e.getCause();
    } catch (InterruptedException e) {
      throw SpannerExceptionFactory.propagateInterrupt(e);
    }
    // [END instance_admin_client_update_instance]
  }
1290612
public function update_instance($instance, $data) {
        global $DB;

        parent::update_instance($instance, $data);

        // Remove the fields we don't want to override.
        unset($data->id);
        unset($data->timecreated);
        unset($data->timemodified);

        // Convert to an array we can loop over.
        $fields = (array) $data;

        // Update the data in our table.
        $tool = new stdClass();
        $tool->id = $data->toolid;
        $tool->timemodified = time();
        foreach ($fields as $field => $value) {
            $tool->$field = $value;
        }

        return $DB->update_record('enrol_lti_tools', $tool);
    }
536320
public function setInstanceAnonymousness($instanceName, $anonymous) {
		if ($anonymous) {
			$this->declaredInstances[$instanceName]['anonymous'] = true;
			// An anonymous object must be weak.
			$this->declaredInstances[$instanceName]['weak'] = true;
		} else {
			unset($this->declaredInstances[$instanceName]['anonymous']);
		}
	}
213590
public function update(array $values)
	{
		$bindings = array_values(array_merge($values, $this->bindings));

		$sql = $this->grammar->compileUpdate($this, $values);

		return $this->connection->update($sql, $this->cleanBindings($bindings));
	}
924373
public function update($model, $query, $values = null, $value = null)
    {
        $key = $this->getPrimaryKey($model);

        if (!is_array($query)) {
            $query = [
                $key => $query,
            ];
        }

        if (is_string($values)) {
            $values = [$values => $value];
            $value = null;
        }

        if (is_null($values)) {
            $values = $query;
            $query = [$key => $query[$key]];
        }

        $params = [];
        $setArray = [];

        foreach ($values as $field => $value) {
            $token = ':'.$field;
            $setArray[] = "`{$field}` = {$token}";
            $params[$token] = $value;
        }

        $set = implode(',', $setArray);
        $table = $this->getPrefix($model);
        $where = $this->getUpdateWhere($query, $params);
        $sql = "UPDATE `{$table}` SET {$set} WHERE {$where}";

        $this->execute($sql, $params);
    }
780255
function apply($value, $instance = null, $attribute = null)
    {
        if(!$instance->$attribute) {
            return null;
        }

        if(!$instance->$attribute instanceof SharpUploadModel) {
            throw new SharpException("[$attribute] mist be an instance of SharpUploadModel");
        }

        return '<img src="'
            . $instance->$attribute->thumbnail($this->width, $this->height, $this->filters)
            . '" alt="" class="img-fluid">';
    }
813078
public static function setInstance($instance = "") {
		
		if (empty($instance) || !method_exists($instance,'addGlobal')) {
			Console::writeError("please set the instance");
		}
		
		self::$instance = $instance;

	}
1201078
def update(self, instance):
        '''
        
        '''

        if not self.exists(instance.__class__, instance.id):
            print("Cant update a value that does not exist")
            return False

        instance_dict = vars(instance)

        table = instance.__class__.__name__.lower()
        keys = ", ".join(instance_dict.keys())
        values = tuple(instance_dict.values())

        SQL = """UPDATE {} SET """.format(table)

        for key, value in instance_dict.items():
            SQL += """ %s = "%s" ,""" % (key, value)

        SQL = SQL[:-1] + """ WHERE id = "{}" """.format(instance.id)

        if self.DEBUG: print(SQL)

        try:
            with Session(self.settings) as conn:
                c = conn.cursor()
                c.execute(SQL)
                conn.commit()
                return True
        except Exception as e:
            raise e
1338141
public static function set_properties(&$instance, $params) {
        $params = (array) $params;
        foreach ($params as $var => $value) {
            if (in_array($var, $instance->required_fields) or array_key_exists($var, $instance->optional_fields)) {
                $instance->$var = $value;
            }
        }
    }
216927
private function updateInitializedPropertyValue($propertyName, $value)
    {
        if (empty($this->_collectionsItemNames['byProperty'][$propertyName])) {
            $this->updatePropertyAssociation($propertyName, array("oldValue" => null, "newValue" => $value));
        } else {
            foreach ($value as $newValue) {
                $this->updatePropertyAssociation($propertyName, array("oldValue" => null, "newValue" => $newValue));
            }
        }
    }