Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unmarshalItem DynamoDB & PHP not working

I wanted to unmarshal the dynamodb scan query response and here is my code

$client = $this->getClient();
        $result = $client->scan([
            'ExpressionAttributeValues' => [
                ':v1' => [
                    'S' => "200",
                ],
            ],
            'FilterExpression' => 'id = :v1',
            'ProjectionExpression' => "entryStamp",
            'TableName' => $this->table,
        ]);
        return $this->unmarshalItem($result['Items']);

It returns error "Unexpected type: entryStamp."

like image 576
Saurabh Sharma Avatar asked Sep 17 '25 07:09

Saurabh Sharma


1 Answers

I was searching for this myself and it doesn't seem possible at the moment.

I didn't find anything specifically about PHP but this thread describe the exact same problem with GO.

So the best way to go about it is to do what Saurabh advised in his comment:

$result = $this->client->query($params); 

$data = [];
foreach( $result['Items'] as $item)
{
    $data[] = $marshaler->unmarshalItem($item);
}

return $data;
like image 171
Tonio Avatar answered Sep 19 '25 02:09

Tonio