@param $updateBindsByKeys

@return StorageDataRequest
193838
public function getBatchUpdateRequest($updateBindsByKeys)
    {
        return new StorageDataRequest(
            [$this->sourceDataAdapter, $this->cacheDataAdapter, $updateBindsByKeys],
            function (DataAdapterInterface $sourceData, DataAdapterInterface $cacheData, $updateBindsByKeys) {
                $request = $sourceData->getBatchUpdateRequest($updateBindsByKeys);
                $request->send();
                $result = $request->fetch();
                if ($result) {
                    $cacheData->getDeleteRequest(array_keys($updateBindsByKeys))->send();
                }
            
                return $result;
            }
        );
    }
833518
public function set_metadatas(array $metadatas, $force_readonly = false)
    {
        $databox_descriptionStructure = $this->getDatabox()->get_meta_structure();

        foreach ($metadatas as $param) {
            if (!is_array($param)) {
                throw new Exception_InvalidArgument('Invalid metadatas argument');
            }

            $db_field = $databox_descriptionStructure->get_element($param['meta_struct_id']);

            if ($db_field->is_readonly() === true && !$force_readonly) {
                continue;
            }

            $this->set_metadata($param, $this->getDatabox());
        }

        $xml = new DOMDocument();
        $xml->loadXML($this->app['serializer.caption']->serialize($this->get_caption(), CaptionSerializer::SERIALIZE_XML, true));

        $this->set_xml($xml);
        unset($xml);

        $this->write_metas();
        $this->dispatch(RecordEvents::METADATA_CHANGED, new MetadataChangedEvent($this));

        return $this;
    }
1012098
protected function _putData($key, $data)
    {
        $bool = $this->_validateDataKey($key, $data);
        if (!$bool) {
            return $this;
        }

        $hasData = $this->has($key);
        if ($this->_setPreparationOn) {
            $data = $this->_dataPreparation(
                $key,
                $data,
                $this->_dataPreparationCallbacks
            );
        }

        if (!$hasData
            || ($hasData && $this->_comparator($this->_DATA[$key], $data, '!=='))
        ) {
            $this->_changeData($key, $data, $hasData);
        }

        return $this;
    }
1018092
public function prepareBindingsForUpdate(array $bindings, array $values)
    {
        $values = collect($values)->reject(function ($value, $column) {
            return $this->isJsonSelector($column) &&
            in_array(gettype($value), ['boolean', 'integer', 'double']);
        })->all();

        return parent::prepareBindingsForUpdate($bindings, $values);
    }
67892
public function sync($ids, $detaching = true)
    {
        $changes = [
            'attached' => [],
            'detached' => [],
            'updated'  => [],
        ];

        $pk = $this->parent->getPk();

        $current = $this->pivot
            ->where($this->localKey, $this->parent->$pk)
            ->column($this->foreignKey);

        $records = [];

        foreach ($ids as $key => $value) {
            if (!is_array($value)) {
                $records[$value] = [];
            } else {
                $records[$key] = $value;
            }
        }

        $detach = array_diff($current, array_keys($records));

        if ($detaching && count($detach) > 0) {
            $this->detach($detach);
            $changes['detached'] = $detach;
        }

        foreach ($records as $id => $attributes) {
            if (!in_array($id, $current)) {
                $this->attach($id, $attributes);
                $changes['attached'][] = $id;
            } elseif (count($attributes) > 0 && $this->attach($id, $attributes)) {
                $changes['updated'][] = $id;
            }
        }

        return $changes;
    }
1091080
public function update( $data = array(), $stripTags = TRUE ){
		if( !( is_array( $data ) && $data ) )
			throw new \InvalidArgumentException( 'Data for update must be an array and have atleast 1 pair' );
		$this->validateFocus();
		$has	= $this->get( FALSE );
		if( !$has )
			throw new \InvalidArgumentException( 'No data sets focused for update' );
		$updates	= array();
		foreach( $this->columns as $column ){
			if( !array_key_exists($column, $data) )
				continue;
			$value	= $data[$column];
			if( $stripTags && $value !== NULL )
				$value	= strip_tags( $value );
			$value	= $this->secureValue( $value );
			$updates[] = '`'.$column.'`='.$value;
		}
		if( sizeof( $updates ) ){
			$updates	= implode( ', ', $updates );
			$query	= 'UPDATE '.$this->getTableName().' SET '.$updates.' WHERE '.$this->getConditionQuery( array() );
			$result	= $this->dbc->exec( $query );
			return $result;
		}
	}
1217719
public function setDataSource($dataSource = null, $refreshDataValues = true) {
		$this->_dataSource = $dataSource;

		if ($refreshDataValues) {
			//	TO DO
		}

		return $this;
	}
425434
public function getDeleteRequest($ids)
    {
        $self = $this;
        $request = new StorageDataRequest(
            [$ids],
            function ($ids) use ($self) {
                $tablePath = $self->_getTablePath();
                $results = [];
                foreach ($ids as $id) {
                    $filePath = $tablePath.$id;
                    $results[$id] = unlink($filePath);
                }
            
                return $results;
            }
        );
        
        return $request;
    }
279718
public function update($service, $headers = null, $data)
	{
		return $this->put($service, $headers, $data);
	}
1063839
public function getBatchInsertRequest($insertBindsByKeys)
    {
        $db = $this->_getConnection();
        $table = $this->table;
        $self = $this;
        $primary = $this->_getPrimaryKetArray();

        $request = new StorageDataRequest(
            [$insertBindsByKeys],
            function ($insertBindsByKeys) use ($db, $table, $self, $primary) {
                if (!$db) {
                    $self->logError('Missing connection on getBatchInsertRequest on table: ' . $table);
                    return false;
                }

                $firstElement = \reset($insertBindsByKeys);
                if (!$firstElement) {
                    $self->logError('Empty bind or first element on getBatchInsertRequest on table: ' . $table);
                    return [];
                }

                $keys = array_unique(array_merge($primary, array_keys($firstElement)));

                $primaryHintApplicable = \count($primary) === 1;

                $valuesArray = [];
                foreach ($insertBindsByKeys as $id => $bind) {
                    $values = [];

                    if ($primaryHintApplicable) {
                        $bind = $self->prepareKey($primary, $id) + $bind;
                    }

                    $bind = $self->prepareBind($bind, $db);
                    foreach ($keys as $key) {
                        $values[] = $bind[$key] ?? null;
                    }

                    $valuesArray[] = '(' . implode(',', $values) . ')';
                }

                $query = 'INSERT INTO ' . $table . ' as t '
                    . ' (' . implode(',', $keys) . ') VALUES '
                    . implode(',', $valuesArray)
                    . $self->makeConstraintHintPostfix()
                    . ' RETURNING *';

                $stmnt = $db->query($query);

                if (!$stmnt) {
                    $self->logError('Cannot execute getBatchInsertRequest on table: ' . $table . ':' . implode(',', $db->errorInfo()), [
                        'code' => $db->errorCode(),
                    ]);

                    return false;
                }

                $result = $stmnt->fetchAll(PDO::FETCH_ASSOC);

                if (!$result && (int) $stmnt->errorCode() > 0) {
                    $self->logError('Error on execution on getBatchInsertRequest on table: ' . $table . ':' . implode(',',
                            $stmnt->errorInfo()), [
                        'code' => $stmnt->errorCode(),
                    ]);

                    return false;
                }

                return $result;
            });

        return $request;
    }
772982
public function getUpdateRequest($id, $updateBind)
    {
        $db = $this->_getConnection();
        $table = $this->table;
        $self = $this;
        $primary = $this->_getPrimaryKetArray();

        $request = new StorageDataRequest(
            [$id, $updateBind],
            function ($id, $updateBind) use ($db, $table, $self, $primary) {
                if (!$db) {
                    $self->logError('Missing connection on getUpdateRequest on table: ' . $table);
                    return false;
                }

                $keyBind = $self->prepareKey($primary, $id);

                $whereBind = $self->prepareBind($keyBind, $db);
                $whereArray = [];
                foreach ($whereBind as $key => $value) {
                    $whereArray[] = $key . ' = ' . $value;
                }

                $keys = [];
                $values = [];

                $updateBind = $self->prepareBind($updateBind, $db);

                foreach ($updateBind as $key => $value) {
                    $keys[] = $key;
                    $values[] = $value;
                }

                $query = 'UPDATE ' . $table
                    . ' SET (' . implode(',', $keys) . ') = ROW(' . implode(',', $values) . ') '
                    . ' WHERE ' . implode(' AND ', $whereArray)
                    . ' RETURNING *';
                $stmnt = $db->query($query);

                if (!$stmnt) {
                    $this->logError('Cannot execute getUpdateRequest on table: ' . $table . ':' . implode(',', $db->errorInfo()), [
                        'code' => $db->errorCode(),
                    ]);

                    return false;
                }

                $result = $stmnt->fetch(PDO::FETCH_ASSOC);

                if (!$result && (int) $stmnt->errorCode() > 0) {
                    $this->logError('Error on execution on getUpdateRequest on table: ' . $table . ':' . implode(',',
                            $stmnt->errorInfo()), [
                        'code' => $stmnt->errorCode(),
                    ]);

                    return false;
                }

                return $result;
            });

        return $request;
    }
611940
public function getReadRequest($ids)
    {
        $cacheDataAdapter = $this->cacheDataAdapter; 
        $primaryKey = $this->primaryKey;
        return new StorageDataRequest(
            [$this->sourceDataAdapter, $this->cacheDataAdapter, $ids],
            function (DataAdapterInterface $sourceData, DataAdapterInterface $cacheData, $ids) {
                $request = $cacheData->getReadRequest($ids);
                $request->send();
                
                $cacheReadResult = $request->fetch();
                
                $cacheReadSuccess = count($cacheReadResult) == count($ids);
                if (!$cacheReadSuccess) {
                    $request = $sourceData->getReadRequest($ids);
                    $request->send();
                }
            
                return [$request, $cacheReadSuccess];
            },
            function (StorageDataRequest $request, $cacheReadSuccess) use ($cacheDataAdapter, $primaryKey) {
                $result = $request->fetch();
                if ($result && !$cacheReadSuccess) {
                    $cacheDataAdapter->getBatchInsertRequest($result)->send();
                }
                
                return $result;
            }
        );
    }
316454
public function updateOrCreate(array $attributes, array $updateAttributes)
    {
        $model = $this->get($attributes);
        if (null === $model) {
            $model = $this->getModel()->create();
            $model->setIsNewRecord(true);
        }

        $model->setAttributes($updateAttributes);
        if ($model->save()) {
            return $model;
        }

        return false;
    }
362205
public function getBatchInsertRequest($insertBindsByKeys)
    {
        $self = $this;
        $primary = $this->primaryKey;

        return new StorageDataRequest(
            [$insertBindsByKeys, $primary],
            function ($insertBindsByKeys, $primary) use ($self) {
                $router = $self->getRouter();
                $queueKey = $self->getQueueKey();
                $resource = $self->getResource();

                foreach ($insertBindsByKeys as $id => &$bind) {
                    $bind[$primary] = $id;
                    $queue = $bind[$queueKey] ?? $resource;
                    $router->publish($bind, $queue);
                }
                unset($bind);

                return $insertBindsByKeys;
            }
        );
    }
797622
public function update($repository, $keys, $data)
    {
        $context = $this->getCommandContext();

        $context->data = $data;
        $context->repository = $repository;
        $context->keys = $keys;
        $context->query = AnDomainQuery::getInstance($repository, $keys)->update(AnConfig::unbox($data));

        if ($this->getCommandChain()->run('before.update', $context) !== false) {
            $context->result = $this->execute($context->query);
            $this->getCommandChain()->run('after.update', $context);
        }

        return $context->result;
    }
585660
protected static function replaceUrlParameterBindings(string $uri, array $bindings)
    {
        foreach ($bindings as $path => $binding) {
            // So we can support partial bindings like
            // 'bindings' => [
            //  'foo/{type}' => 4,
            //  'bar/{type}' => 2
            //],
            if (Str::is("*$path*", $uri)) {
                preg_match('/({.+?})/', $path, $parameter);
                $uri = str_replace("{$parameter['1']}", $binding, $uri);
            }
        }
        // Replace any unbound parameters with '1'
        $uri = preg_replace('/{(.+?)}/', 1, $uri);

        return $uri;
    }
1208083
public function update($sql, $bindings = array())
		{
			list($statement, $result) = $this->execute($sql, $bindings);
			return $statement->rowCount();
		}