/** * {@inheritDoc} */ public function find($storageName, $key) { $iterator = new ItemIterator($this->client->getScanIterator(['TableName' => $storageName, 'Key' => ['Id' => ['S' => $key]]])); $results = $iterator->toArray(); if (count($results)) { return array_shift($results); } throw new NotFoundException(); }
/** * {@inheritDoc} */ public function find($storageName, $key) { $iterator = new ItemIterator($this->client->getScanIterator(array("TableName" => $storageName, "Key" => array("Id" => array('S' => $key))))); $results = $iterator->toArray(); if (count($results)) { return array_shift($results); } throw new NotFoundException(); }
/** * Executes the GetScanIterator operation. * * @param string $tableName The name of the table containing the requested items. * @param array $args Arguments of the query * * @return Guzzle\Service\Resource\ResourceIteratorInterface * * @see http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.DynamoDb.DynamoDbClient.html#_getScanIterator */ public function getScanIterator($tableName, array $args) { $args['TableName'] = $tableName; return $this->client->getScanIterator($args); }