From 0689b60bdca9c3e3cc4fd6dcfb8762ef17cb2d02 Mon Sep 17 00:00:00 2001 From: Gabriel Jenik Date: Wed, 20 Jul 2016 12:03:40 -0300 Subject: [PATCH] Misc Fix and Enhancements - New method CreateFromClient (to reuse an already existing AWS Dynamo Client, usefull for client reusing or polling) - Fixed error appearing when scan method was used with no filter. --- DynamoDBWrapper.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/DynamoDBWrapper.php b/DynamoDBWrapper.php index 1791bf9..005d882 100644 --- a/DynamoDBWrapper.php +++ b/DynamoDBWrapper.php @@ -1,5 +1,7 @@ client = DynamoDbClient::factory($args); + } + } + + public static function createFromClient($client) + { + $dyn = new DynamoDBWrapper(); + $dyn->client = $client; + + return $dyn; } public function get($tableName, $key, $options = array()) @@ -117,7 +130,7 @@ public function count($tableName, $keyConditions, $options = array()) public function scan($tableName, $filter, $limit = null) { if (empty($filter)) { - $scanFilter = null; + $scanFilter = array(); } else { $scanFilter = $this->convertConditions($filter); } @@ -442,7 +455,7 @@ protected function convertItems($items) /** * convert string attribute paramter to array components. - * + * * @param string $attribute double colon separated string "::" * @return array parsed parameter. [0]=, [1]= */