getName() !== 'DeleteItem') { throw new InvalidArgumentException(); } // Get relevant data for a DeleteRequest $table = $command->get('TableName'); $key = $command->get('Key'); // Return an instantiated DeleteRequest object return new DeleteRequest($key, $table); } /** * Constructs a new delete request * * @param array $key The key of the item to delete * @param string $tableName The name of the table which has the item */ public function __construct(array $key, $tableName) { $this->key = $key; $this->tableName = $tableName; } /** * The parameter form of the request * * @return array */ public function toArray() { $key = $this->key; foreach ($key as &$element) { if ($element instanceof Attribute) { $element = $element->toArray(); } } return array('DeleteRequest' => array('Key' => $key)); } /** * Get the key * * @return array */ public function getKey() { return $this->key; } }