performs a SimpleUpdate query for the given entity
@param $entity
@return UpdateResult
770939
public function simpleUpdate($entity){
        $simpleUpdate = new SimpleUpdate($entity,$this->getConfig());
        return $this->update($simpleUpdate);
    }
599878
public function setEntity($entity)
    {
        if ($this->isRegistryEntity(get_class($entity))) {
            $this->classname = get_class($entity);
        }
        $this->entity = $entity;

        return $this;
    }
96243
public function update(string $table): Query\Update
    {
        $query = new Query\Update();
        $query->update($table);
        return $query;
    }
291619
public int update(Entity entity) throws SQLException {
		if (CollectionUtil.isEmpty(entity)) {
			return 0;
		}
		entity = fixEntity(entity);
		Object pk = entity.get(primaryKeyField);
		if (null == pk) {
			throw new SQLException(StrUtil.format("Please determine `{}` for update", primaryKeyField));
		}

		final Entity where = Entity.create(tableName).set(primaryKeyField, pk);
		final Entity record = (Entity) entity.clone();
		record.remove(primaryKeyField);

		return db.update(record, where);
	}
585687
public function update(AbstractEntity $entity)
    {
        if ($this->updatedTimestampColumn) {
            $entity->exchangeArray([$this->updatedTimestampColumn => time()]);
        }

        if ($this->updatedDatetimeColumn) {
            $entity->exchangeArray([$this->updatedDatetimeColumn => date('Y-m-d H:i:s')]);
        }

        $this->updateRow($entity);

        return $entity;
    }
900681
protected function singleEntity($entity)
    {
        if (empty($entity)) {
            return null;
        }

        $singleEntity = $entity;

        if (is_array($entity)) {
            if (count($entity) > 1) {
                throw RuntimeException::multipleResultsFound();
            }

            $singleEntity = reset($entity);
        }

        $entityClass = $this->getEntityName();

        if (!$singleEntity instanceof $entityClass) {
            throw InvalidArgumentException::invalidEntityType(
                $this->getEntityName(),
                $singleEntity
            );
        }

        return $singleEntity;
    }
594281
@Override
    public T update(T entity) {
        EntityManager entityManager = getEntityManager();
        T result = entityManager.merge(entity);
        return result;
    }
264198
public function update(AccessTokenEntity $entity)
    {
        $dbValueArray = $entity->getDbValues();

        $condition = ['access_token' => $entity->getAccessToken()];

        $query = $this->getSqlObject()
            ->update()
            ->set($dbValueArray)
            ->where($condition);

        $this->execute($query);

        return $entity;
    }
845333
protected function patchRow(AbstractEntity $entity)
    {
        $values = $entity->getChangedDbValues();
        if (empty($values)) {
            return;
        }

        $query = $this->getSqlObject()
            ->update()
            ->set($values)
            ->where($this->getPrimaryKeyWheres($entity));

        $this->execute($query);
    }
337477
public T update(T entity) throws RowNotFoundException, OptimisticLockException {

        if (!hasPrimaryKey(entity)) {
            throw new RuntimeException(String.format("Tried to update entity of type %s without a primary key", entity
                    .getClass().getSimpleName()));
        }

        UpdateCreator update = new UpdateCreator(table);

        update.whereEquals(idColumn.getColumnName(), getPrimaryKey(entity));

        if (versionColumn != null) {
            update.set(versionColumn.getColumnName() + " = " + versionColumn.getColumnName() + " + 1");
            update.whereEquals(versionColumn.getColumnName(), getVersion(entity));
        }

        for (Column column : columns) {
            if (!column.isReadOnly()) {
                update.setValue(column.getColumnName(), getFieldValueAsColumn(entity, column));
            }
        }

        int rows = new JdbcTemplate(ormConfig.getDataSource()).update(update);

        if (rows == 1) {

            if (versionColumn != null) {
                ReflectionUtils.setFieldValue(entity, versionColumn.getFieldName(), getVersion(entity) + 1);
            }

            return entity;

        } else if (rows > 1) {

            throw new RuntimeException(
                    String.format("Updating table %s with id %s updated %d rows. There must be a mapping problem. Is column %s really the primary key?",
                            table, getPrimaryKey(entity), rows, idColumn));

        } else {

            //
            // Updated zero rows. This could be because our ID is wrong, or
            // because our object is out-of date. Let's try querying just by ID.
            //

            SelectCreator selectById = new SelectCreator()
            .column("count(*)")
            .from(table)
            .whereEquals(idColumn.getColumnName(), getPrimaryKey(entity));

            rows = new JdbcTemplate(ormConfig.getDataSource()).query(selectById, new ResultSetExtractor<Integer>() {
                @Override
                public Integer extractData(ResultSet rs) throws SQLException, DataAccessException {
                    rs.next();
                    return rs.getInt(1);
                }
            });

            if (rows == 0) {
                throw new RowNotFoundException(table, getPrimaryKey(entity));
            } else {
                throw new OptimisticLockException(table, getPrimaryKey(entity));
            }
        }
    }
1101753
public function commit($entity = null)
    {
        if ($this->evm->hasListeners(Events::preFlush)) {
            $this->evm->dispatchEvent(Events::preFlush, new Event\PreFlushEventArgs($this->sm));
        }

        //TODO: single/array entity commit handling
        $this->commitRemoved();
        $this->commitPersisted();

        //Force refresh of updated indexes
        if ($entity === true) {
            $client = $this->sm->getClient();
            foreach (array_unique($this->updatedIndexes) as $index) {
                $client->refreshIndex($index);
            }
        }

        $this->clear();

        if ($this->evm->hasListeners(Events::postFlush)) {
            $this->evm->dispatchEvent(Events::postFlush, new Event\PostFlushEventArgs($this->sm));
        }
    }
170218
public function updateEntityById($entity, $bind, $id)
    {
        $tbl = $this->resource->getTableName($entity);
        if ($bind instanceof DataObject) {
            $data = $bind->get();
        } else {
            $data = $bind;
        }
        $where = '1';
        foreach ($id as $field => $value) {
            $where .= " AND $field=" . $this->conn->quote($value);
        }
        $result = $this->conn->update($tbl, $data, $where);
        return $result;
    }
790182
private function applyEntityToDatabase($entity, $update)
    {
        if (!$entity->isValid()) {
            // #@todo handle somehow, maybe throw exception?
            return false;
        }
        if ($update) {
            $command = 'REPLACE INTO';
        } else {
            $command = 'INSERT INTO';
        }
        $query =
            $command . ' `' . $this->tableName . '` (`' .
            $this->getFields("`, `") .
            '`) VALUES (:' .
            $this->getFields(", :") .
            ');';
        $statement = $this->database->prepare($query);
        $valueArray = $entity->getValueArray();
        foreach ($this->entityFields as $index => $paramName) {
            $statement->bindParam(':' . $paramName, $valueArray[$index]);
        }
        $isSuccessful = $statement->execute();
        // #@todo throw and exception if $stmt->errorInfo() has an error?
        // var_dump($statement->errorInfo());

        $this->lastInsertId = $this->database->lastInsertId();

        return $isSuccessful;
    }
61772
public static function buildUpdateQuery($entity, Mapper $mapper) {
        $fields = "";
        foreach ($mapper->getPropertys() as $property) {
            if ($property->getColumn() != "id") {
                $method = "get" . $property->getName();
                $entity->$method();

                if ($property->isNumeric()) {
                    $fieldValue = "`=:" . $property->getColumn() . ", ";
                } else {
                    $fieldValue = "`=:" . $property->getColumn() . ", ";
                }
                $fields .= "`" . $property->getColumn() . $fieldValue;
            }
        }
        $fields = substr_replace($fields, "", -2);
        $query = "UPDATE `" . $mapper->getTable() . "` SET " . $fields . " WHERE id=:id";

        return $query;
    }
479209
public function persist(Entity $entity)
    {
        $this->checkEntityType($entity);

        $this->events->invokeCallbacks(Events::EVENT_BEFORE_PERSIST, $entity);
        if ($entity->isDetached()) {
            $entity->makeAlive($this->entityFactory, $this->connection, $this->mapper);
            $this->events->invokeCallbacks(Events::EVENT_BEFORE_CREATE, $entity);
            $result = $id = $this->insertIntoDatabase($entity);
            $entity->attach($id);
            $this->events->invokeCallbacks(Events::EVENT_AFTER_CREATE, $entity);
        } else {
            if ($entity->isModified()) {
                $this->events->invokeCallbacks(Events::EVENT_BEFORE_UPDATE, $entity);
                $result = $this->updateInDatabase($entity);
                $this->events->invokeCallbacks(Events::EVENT_AFTER_UPDATE, $entity);
            }
            $this->persistHasManyChanges($entity);
            $entity->markAsUpdated();
        }
        $this->events->invokeCallbacks(Events::EVENT_AFTER_PERSIST, $entity);

        return isset($result) ? $result : null;
    }
48196
public int addOrUpdate(Entity entity) throws SQLException {
		return null == entity.get(primaryKeyField) ? add(entity) : update(entity);
	}
147691
protected function updateActionInternal(ModelInterface $entity) {
        $params = new Params($this->request);
        if(is_array($params->getParams())) {
            throw new Exception('Bulk Updating is not supported: An array of objects was passed in', 400);
        }
        $this->saveEntity($params->getParams(), $entity, false);
        // we stopped returning a 304 because the internet is a terrible place where no one follows the rules.
        return true;
    }