/** * {@inheritDoc} */ public function update($storageName, $key, array $data) { $this->prepareData($key, $data); unset($data['id']); foreach ($data as $k => $v) { $data[$k] = ['Value' => $this->client->formatValue($v)]; } $result = $this->client->updateItem(['TableName' => $storageName, 'Key' => ['id' => ['S' => $key]], 'AttributeUpdates' => $data]); }
/** * {@inheritDoc} */ public function update($storageName, $key, array $data) { $this->prepareData($key, $data); unset($data['id']); foreach ($data as $k => $v) { $data[$k] = array("Value" => $this->client->formatValue($v)); } $result = $this->client->updateItem(array('TableName' => $storageName, 'Key' => array("id" => array('S' => $key)), "AttributeUpdates" => $data)); }
/** * Formats a value as a DynamoDB attribute * * @param mixed $value The value to format for DynamoDB. * @param string $format The type of format (e.g. put, update). * * @return array The formatted value */ public function formatValue($value, $format = Attribute::FORMAT_PUT) { return $this->client->formatValue($value, $format); }