当前位置: 首页>>代码示例>>PHP>>正文


PHP DynamoDbClient::deleteItem方法代码示例

本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::deleteItem方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::deleteItem方法的具体用法?PHP DynamoDbClient::deleteItem怎么用?PHP DynamoDbClient::deleteItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aws\DynamoDb\DynamoDbClient的用法示例。


在下文中一共展示了DynamoDbClient::deleteItem方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  * Delete an item via the delete_item call
  * @param string $table The item table
  * @param mixed $hash The primary hash key
  * @param mixed|null $range The primary range key
  * @param Context\Delete|null $context The call context
  * @return array|null
  */
 public function delete($table, $hash, $range = null, Context\Delete $context = null)
 {
     if (null !== $this->logger) {
         $this->log('Delete on table ' . $table);
     }
     // Primary key
     $hash = new Attribute($hash);
     $key = array('HashKeyElement' => $hash->getForDynamoDB());
     // Range key
     if (null !== $range) {
         $range = new Attribute($range);
         $key['RangeKeyElement'] = $range->getForDynamoDB();
     }
     $parameters = array('TableName' => $table, 'Key' => $key);
     if (null !== $context) {
         $parameters += $context->getForDynamoDB();
     }
     if (null !== $this->logger) {
         $this->log('Delete request paramaters : ' . print_r($parameters, true), Logger::DEBUG);
     }
     $response = $this->connector->deleteItem($parameters);
     if (null !== $this->logger) {
         $this->log('Delete request response : ' . print_r($response, true), Logger::DEBUG);
     }
     // Update write counter
     $this->addConsumedWriteUnits($table, floatval($response['ConsumedCapacityUnits']));
     return $this->populateAttributes($response);
 }
开发者ID:16hands,项目名称:riverline-dynamodb,代码行数:36,代码来源:Connection.php

示例2: delete

 public function delete()
 {
     $query = ['TableName' => $this->getTable(), 'Key' => static::getDynamoDbKey($this, $this->getKey())];
     $result = $this->client->deleteItem($query);
     $status = array_get($result->toArray(), '@metadata.statusCode');
     return $status == 200;
 }
开发者ID:warrick-loyaltycorp,项目名称:laravel-dynamodb,代码行数:7,代码来源:DynamoDbModel.php

示例3: delete

 /**
  * @inheritdoc
  */
 public function delete()
 {
     $key = $this->getModelKey($this->getKeyAsArray(), $this);
     $query = ['TableName' => $this->getTable(), 'Key' => $key];
     $result = $this->client->deleteItem($query);
     $status = array_get($result->toArray(), '@metadata.statusCode');
     return $status === 200;
 }
开发者ID:nordsoftware,项目名称:lumen-dynamodb,代码行数:11,代码来源:DynamoDbModel.php

示例4: delete

 /**
  * Delete record
  *
  * @return mixed
  * @link http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.DynamoDb.DynamoDbClient.html#_deleteItem
  */
 public function delete()
 {
     $conditions = $this->_getKeyConditions();
     $args = array('TableName' => $this->_table_name, 'Key' => $conditions, 'ReturnValues' => 'ALL_OLD');
     $result = self::$_client->deleteItem($args);
     self::_logQuery('deleteItem', $args, $result);
     return $result;
 }
开发者ID:albertleao,项目名称:kettle,代码行数:14,代码来源:kettle.php

示例5: deleteItem

 /**
  * Executes the DeleteItem operation.
  *
  * @param string $tableName                   The name of the table from which to delete the item.
  * @param array  $key                         Associative array of <AttributeName> keys mapping to (associative-array) values.
  * @param array  $expected                    This is the conditional block for the DeleteItem operation. All the conditions must be met for the operation to succeed.
  * @param string $conditionnalOperator        Operator between each condition of $expected argument.
  * @param string $returnValues                Use ReturnValues if you want to get the item attributes as they appeared before they were deleted.
  * @param string $returnConsumedCapacity      Sets consumed capacity return mode.
  * @param string $returnItemCollectionMetrics If set to SIZE, statistics about item collections, if any, that were modified during the operation are returned in the response.
  *
  * @return Guzzle\Service\Resource\Model
  *
  * @see http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.DynamoDb.DynamoDbClient.html#_deleteItem
  */
 public function deleteItem($tableName, array $key, array $expected = null, $conditionnalOperator = self::COND_AND, $returnValues = self::RETURN_NONE, $returnConsumedCapacity = self::CAPACITY_NONE, $returnItemCollectionMetrics = self::METRICS_NONE)
 {
     $args = ['TableName' => $tableName, 'Key' => $key, 'ConditionnalOperator' => $conditionnalOperator, 'ReturnValues' => $returnValues, 'ReturnConsumedCapacity' => $returnConsumedCapacity, 'ReturnItemCollectionMetrics' => $returnItemCollectionMetrics];
     if ($expected !== null) {
         $args['Expected'] = $expected;
     }
     return $this->client->deleteItem($args);
 }
开发者ID:m6web,项目名称:aws-bundle,代码行数:23,代码来源:Client.php

示例6: delete

 /**
  * {@inheritDoc}
  *
  * @throws \Aws\DynamoDb\Exception\DynamoDBException
  *
  * @see http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.DynamoDb.DynamoDbClient.html#_deleteItem
  */
 public function delete(EntityInterface $entity, array $commandOptions = array())
 {
     $this->dispatchEntityRequestEvent(Events::ENTITY_PRE_DELETE, $entity);
     $commandOptions += array('TableName' => $this->getEntityTable($entity), 'Key' => $this->formatKeyCondition($entity));
     $model = $this->dynamoDb->deleteItem($commandOptions);
     $this->dispatchEntityResponseEvent(Events::ENTITY_POST_DELETE, $entity, $model);
     return true;
 }
开发者ID:cpliakas,项目名称:dynamo-db-odm,代码行数:15,代码来源:DocumentManager.php

示例7: del

 /**
  * (non-PHPdoc)
  * 
  * @see common_persistence_KvDriver::del()
  */
 public function del($key)
 {
     try {
         $this->client->deleteItem(array('TableName' => $this->tableName, 'Key' => array(self::SIMPLE_KEY_NAME => array('S' => $key))));
         common_Logger::i('DEL: ' . $key);
     } catch (\Exception $ex) {
         return false;
     }
     return true;
 }
开发者ID:oat-sa,项目名称:lib-advkv-dynamodb,代码行数:15,代码来源:DynamoDbDriver.php

示例8: testAddsGetsAndDeletesItems

 /**
  * @depends testCreatesTable
  */
 public function testAddsGetsAndDeletesItems()
 {
     $attributes = $this->client->formatAttributes(array('foo' => 'Test', 'bar' => 10, 'baz' => 'abc'));
     self::log('Adding an item to the table: ' . var_export($attributes, true));
     $result = $this->client->putItem(array('TableName' => $this->table, 'Item' => $attributes));
     $this->assertTrue(isset($result['ConsumedCapacityUnits']));
     self::log('Getting the item');
     // Get the item using the formatAttributes helper
     $result = $this->client->getItem(array('TableName' => $this->table, 'Key' => $this->client->formatAttributes(array('HashKeyElement' => 'Test', 'RangeKeyElement' => 10)), 'ConsistentRead' => true));
     $this->assertEquals('Test', $result['Item']['foo']['S']);
     $this->assertEquals(10, $result['Item']['bar']['N']);
     $this->assertEquals('abc', $result['Item']['baz']['S']);
     self::log('Deleting the item');
     $result = $this->client->deleteItem(array('TableName' => $this->table, 'Key' => $this->client->formatAttributes(array('HashKeyElement' => 'Test', 'RangeKeyElement' => 10))));
     $this->assertTrue(isset($result['ConsumedCapacityUnits']));
 }
开发者ID:romainneutron,项目名称:aws-sdk-php,代码行数:19,代码来源:IntegrationTest.php

示例9: regenerateID

 /**
  * Updates the current session id with a newly generated one.
  * Please refer to {@link http://php.net/session_regenerate_id} for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  * @since 1.1.8
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldId = session_id();
     parent::regenerateID(false);
     $newId = session_id();
     $row = $this->getData($oldId);
     if (!is_null($row)) {
         if ($deleteOldSession) {
             // Delete + Put = Update
             $this->dynamoDb->deleteItem(array('TableName' => $this->tableName, 'Key' => array('id' => array('S' => (string) $oldId))));
             $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($this->idColumn => array('S' => (string) $newId), $this->dataColumn => $row[$this->dataColumn], $this->expireColumn => $row[$this->expireColumn])));
         } else {
             $row[$this->idColumn] = array('S' => (string) $newId);
             $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($row)));
         }
     } else {
         $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($this->idColumn => array('S' => $newId), $this->expireColumn => array('N' => $this->getExpireTime()))));
     }
 }
开发者ID:pythagor,项目名称:yii2-dynamodbsession,代码行数:25,代码来源:DynamoDbSession.php

示例10: delete

 /**
  * {@inheritDoc}
  */
 public function delete($storageName, $key)
 {
     $result = $this->client->deleteItem(['TableName' => $storageName, 'Key' => ['id' => ['S' => $key]]]);
 }
开发者ID:billschaller,项目名称:KeyValueStore,代码行数:7,代码来源:DynamoDbStorage.php

示例11: delete

 public function delete($keys)
 {
     $keyItem = DynamoDbItem::createFromArray($keys, $this->attributeTypes);
     $requestArgs = ["TableName" => $this->tableName, "Key" => $keyItem->getData()];
     $this->dbClient->deleteItem($requestArgs);
 }
开发者ID:oasmobile,项目名称:php-aws-wrappers,代码行数:6,代码来源:DynamoDbTable.php

示例12: delete

 /**
  * @param $key
  */
 public function delete($key)
 {
     $this->dynamoDbClient->deleteItem(['TableName' => $this->tableName, 'Key' => [$this->attribute => [$this->getVariableType($key) => (string) $key]]]);
 }
开发者ID:wadify,项目名称:store-key-client-php,代码行数:7,代码来源:Client.php

示例13: delete

 /**
  * {@inheritDoc}
  */
 public function delete($storageName, $key)
 {
     $result = $this->client->deleteItem(array('TableName' => $storageName, 'Key' => array('id' => array('S' => $key))));
 }
开发者ID:pkdevbox,项目名称:KeyValueStore,代码行数:7,代码来源:DynamoDbStorage.php


注:本文中的Aws\DynamoDb\DynamoDbClient::deleteItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。