I am experimenting with WriteRequestBatch from AWS SDK for Dynamodb. Below is my code. Everything works except the WriteRequestBatch part. I have no clue why, and was wondering if the community could help me out here. What might I be doing wrong? I have tried googling and searching here and found only 8 other questions that could be related but unfortunately were of no help.

[This](http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-dynamodb.html#using-the-writerequestbatch) is where I started from. 

```
$ddb_client = DynamoDbClient::factory(array(
    'region' => 'us-east-1',
    'key' => 'my_key',
    'secret' => 'my_secret'
));

$ddb_client->createTable(array(
    'TableName' => 'my_table',
    'AttributeDefinitions' => array(
        array(
            'AttributeName' => 'id',
            'AttributeType' => 'S'
        ),
        array(
            'AttributeName' => 'ns',
            'AttributeType' => 'S'
        )
    ),
    'KeySchema' => array(
        array(
            'AttributeName' => 'id',
            'KeyType'       => 'HASH'
        ),
        array(
            'AttributeName' => 'ns',
            'KeyType'       => 'RANGE'
        )
    ),
    'ProvisionedThroughput' => array(
        'ReadCapacityUnits'  => 10,
        'WriteCapacityUnits' => 10
    )
));

$response = $ddb_client->putItem(array(
    "TableName" => "my_table",
    "Item" => array(
        "id" => array("S" => "exp_id"),
        "ns" => array("S" => "exp_ns"),
        "version" => array("N" => "0"),
    ),
));

$item = $response['Item'];
$item['version']['N'] = '1';

$put_batch = WriteRequestBatch::factory($ddb_client);
$put_request = new PutRequest(
    array(
        "Item" => $item,
        "Expected" => array(
            "version" => array(
                "ComparisonOperator" => "EQ",
                "AttributeValueList" => array(
                    array("N" => "0")
                )
            ),
        ),
    ),
    "my_table"
);
$putBatch->add($put_request);
$putBatch->flush();

```

This works instead of WriteRequestBatch. I will just have to manage batches to put myself than use WriteRequestBatch doing it for me:

```
$response = $ddb_client->batchWriteItem(array(
    "RequestItems" => array(
        "my_table" => array(
            array(
                "PutRequest" => array(
                    "Item" => $item,
                    "Expected" => array(
                        "version" => array(
                            "ComparisonOperator" => "EQ",
                            "AttributeValueList" => array(
                                array("S" => "0")
                            )
                        ),
                    ),
                )
            )
        )
    )
));

```