Update entity value.

@param \Railken\Lem\Contracts\EntityContract $entity
@param \Railken\Bag                          $parameters

@return Collection
181951
public function fill(EntityContract $entity, Bag $parameters)
    {
        $errors = new Collection();

        if ($parameters->exists($this->getRelationName())) {
            $this->getRelationBuilder($entity)->associate($parameters->get($this->getRelationName()));
        }

        return $errors;
    }
530434
@Override
	public void update(Object entity) {
		if (entity == null) {
			throw new IllegalArgumentException("'entity' must not be [" + entity + "]");
		}
		
		assertTransactional();
		((AppEngineGlobalTransaction) transaction.get()).coordinator().update(entity);
	}
740144
protected function persistHasManyChanges(Entity $entity)
    {
        $primaryKey = $this->mapper->getPrimaryKey($this->getTable());
        $idField = $this->mapper->getEntityField($this->getTable(), $primaryKey);
        $driver = $this->connection->getDriver();

        foreach ($entity->getHasManyRowDifferences() as $key => $difference) {
            list($columnReferencingSourceTable, $relationshipTable, $columnReferencingTargetTable) = explode(':', $key);
            $multiInsert = [];
            foreach ($difference as $value => $count) {
                if ($count > 0) {
                    for ($i = 0; $i < $count; $i++) {
                        $multiInsert[] = [
                            $columnReferencingSourceTable => $entity->$idField,
                            $columnReferencingTargetTable => $value,
                        ];
                    }
                } else {
                    if ($driver instanceof \Dibi\Drivers\PostgreDriver) {
                        $this->connection->query(
                            'DELETE FROM %n WHERE [ctid] IN (SELECT [ctid] FROM %n WHERE %n = ? AND %n = ? LIMIT %i)',
                            $relationshipTable,
                            $relationshipTable,
                            $columnReferencingSourceTable,
                            $entity->$idField,
                            $columnReferencingTargetTable,
                            $value,
                            -$count
                        );
                    } elseif ($driver instanceof \Dibi\Drivers\Sqlite3Driver) {
                        $this->connection->query(
                            'DELETE FROM %n WHERE [rowid] IN (SELECT [rowid] FROM %n WHERE %n = ? AND %n = ? LIMIT %i)',
                            $relationshipTable,
                            $relationshipTable,
                            $columnReferencingSourceTable,
                            $entity->$idField,
                            $columnReferencingTargetTable,
                            $value,
                            -$count
                        );
                    } else {
                        $this->connection->query(
                            'DELETE FROM %n WHERE %n = ? AND %n = ? %lmt',
                            $relationshipTable,
                            $columnReferencingSourceTable,
                            $entity->$idField,
                            $columnReferencingTargetTable,
                            $value,
                            -$count
                        );
                    }
                }
            }
            if (!empty($multiInsert)) {
                $this->connection->query(
                    'INSERT INTO %n %ex',
                    $relationshipTable,
                    $multiInsert
                );
            }
        }
    }
1315428
public function push(Entity $entity) {
		$entity->setEntityManager($this->entityManager);
		if ($entity->toRow()) {
			$this->rows[$entity->getPrimary()] = $entity;
		} else {
			$this->rows[] = $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);
    }
1070600
protected function update($entity)
    {
        // If this entity was a child of aggregate roots, then call its methods to set the aggregate root Id
        $this->entityRegistry->runAggregateRootCallbacks($entity);
        $dataMapper = $this->getDataMapper($this->entityRegistry->getClassName($entity));
        $dataMapper->update($entity);
        $this->entityRegistry->registerEntity($entity);
    }
1091028
protected function updateInDatabase(Entity $entity)
    {
        $primaryKey = $this->mapper->getPrimaryKey($this->getTable());
        $values = $entity->getModifiedRowData();
        return $this->connection->query(
            'UPDATE %n SET %a WHERE %n = ?',
            $this->getTable(),
            $values,
            $primaryKey,
            $this->getIdValue($entity)
        );
    }
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;
    }
1023312
public static function updateEntityFromArray($entity, array $data)
    {
        foreach ($data as $field => $value) {
            $method = 'set' . self::formatStringToMethodName($field);
            if (method_exists($entity, $method)) {
                $entity->$method($value);
            }
        }

        return $entity;
    }
739942
public function delete(EntityContract $entity)
    {
        $result = new Result();

        $result->addErrors($this->authorizer->authorize(Tokens::PERMISSION_REMOVE, $entity, Bag::factory([])));

        if (!$result->ok()) {
            return $result;
        }

        try {
            DB::beginTransaction();
            $entity->delete();
            DB::commit();
        } catch (Exception $e) {
            DB::rollBack();

            throw $e;
        }

        return $result;
    }
919629
public function updateBy(Entity $entity, array $filter = [])
    {
        if (!$entity->getValidator()->validate()) {
            throw new Exception\ValidatorException($entity->getValidator());
        }

        try {
            return $this->query()->update($entity->getData())
                ->setFilter($filter)
                ->run($this->connection);
        } catch (Exception\QueryException $e) {
            throw new Exception\RepositoryException($e->getMessage());
        }
    }
561088
public function update(EntityInterface $entity)
	{
		$sql = <<<EOT
UPDATE `$this->tableName` 
SET 
	`ProjectId` = :projectId , 
	`Name` = :name , 
	`Description` = :description , 
	`Tags` = :tags , 
	`Started` = :started , 
	`Stopped` = :stopped 
WHERE `ActivityId` = :id 
EOT;

		$stmt = $this->pdo->prepare($sql);
		$stmt->bindParam(':id', $entity->getActivityId(), \PDO::PARAM_INT);
		$stmt->bindParam(':projectId', $entity->getProjectId(), \PDO::PARAM_INT);
		$stmt->bindParam(':name', $entity->getName(), \PDO::PARAM_STR);
		$stmt->bindParam(':description', $entity->getDescription(), \PDO::PARAM_STR);
		$stmt->bindParam(':tags', $entity->getTags(), \PDO::PARAM_STR);
		$stmt->bindParam(':started', $entity->getStartedRfc3339(), \PDO::PARAM_STR);
		$stmt->bindParam(':stopped', $entity->getStoppedRfc3339(), \PDO::PARAM_STR);
		$res = $stmt->execute();

		if ($res === false || $stmt->rowCount() !== 1) {
			return false;
		}

		return $entity;
	}
1312742
protected function updateField(Entity $entity, $field) {
		if ($entity->dirty($field)) {
			return;
		}

		$entity->set($field, $this->getUserId());
	}
957205
public int update(List<ENTITY> entities) {

        if (entities == null || entities.size() == 0) {
            recordLog(" param entity is null!");
            return 0;
        }

        final List<Query> queries = queryGenerator.getUpdateQuery(entities);
        String sql = queries.get(0).getSql();
        jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {

            public void setValues(PreparedStatement stmt, int index) throws SQLException {
                int i = 1;
                List<Object> params = queries.get(index).getParams();
                for (Object o : params) {
                    stmt.setObject(i++, o);
                }
            }

            public int getBatchSize() {
                return queries.size();
            }
        });

        return entities.size();
    }
604563
private function _updateEntity($entity, $path)
    {
        $method = Resources::HTTP_MERGE;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $statusCode = Resources::STATUS_NO_CONTENT;
        $body = $this->wrapAtomEntry($entity);

        $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode,
            $body
        );
    }
1252734
public static function generateUpdateRequest( Entity $entity ) {
        /* Generate the UpdateRequest message */
        $updateRequestDOM = new DOMDocument();
        $updateNode       = $updateRequestDOM->appendChild( $updateRequestDOM->createElementNS( 'http://schemas.microsoft.com/xrm/2011/Contracts/Services', 'Update' ) );
        $updateNode->appendChild( $updateRequestDOM->importNode( $entity->getEntityDOM(), true ) );

        /* Return the DOMNode */

        return $updateNode;
    }
49443
public function serialize(EntityContract $entity, Collection $select = null)
    {
        $bag = parent::serialize($entity, $select);
        $bag->set('url', $entity->getFullUrl());
        $bag->set('media', $entity->media->count() > 0 ? $entity->media[0]->toArray() : null);

        return $bag;
    }