0
我使用亞馬遜sdk v2和使用aws工廠dynamoDB和我有一個簡單的putItem操作,但我不知道如何可以確保putItem成功或沒有,因爲putItem返回不包含有關操作狀態的任何信息的模型。任何想法? 這裏是我的代碼我如何確保DynamoDB putItem成功
class DynamoLogger{
protected $client;
protected $tableName;
public function __construct(ServiceBuilder $builder, $tableName)
{
$this->client = $builder->get('dynamodb');
$this->tableName = $tableName;
}
public function log(Request $request)
{
$model = $this->client->putItem(array(
'TableName' => $this->tableName,
'Item' => array(
'cc_id' => array(
'S' => $request->get('cc_id')
),
'date' => array(
'S' => date('Y-m-d H:i:s') . substr((string)microtime(), 1, 8)
),
'tt_id' => array(
'N' => $request->get('tt_id')
),
'action_name' => array(
'S' => $request->get('name')
),
'action_value' => array(
'S' => $request->get('value')
),
'gg_nn' => array(
'S' => $request->get('gg_nn')
),
'ffr_id' => array(
'N' => $request->get('ffr_id')
)
),
'ReturnValues' => 'ALL_OLD'
));
return $model;
}
}
這真的幫了很大忙。謝謝。 – ufucuk
沒問題! :-) –