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);
    }
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);
    }
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 ) ; }
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
Delete an item via the delete_item call