remap_attribute_items_for_complextype ( $keys, $replace )

Remaps the custom item-key-value format used by Batchoperations to the more common ComplexList format. Internal use only.

Access

public static

Parameters

Parameter

Type

Required

Description

$keys

array

Required

The key-value format passed by put_attributes().

$replace

boolean
array

Optional

The $replace value passed by batch_put_attributes() and batch_delete_attributes().

Returns

Type

Description

array

A CFComplexType-compatible mapping of parameters.

Source

Method defined in services/sdb.class.php | Toggle source view (30 lines) | View on GitHub

public static function remap_attribute_items_for_complextype($keys, $replace = false)
{
    $map = array(
        'Attribute' => array()
    );

    foreach ($keys as $k => $v)
    {
        $v = is_array($v) ? $v : array($v);

        foreach ($v as $vv)
        {
            $n = array();
            $n['Name'] = $k;
            $n['Value'] = $vv;

            if (
                $replace === (boolean) true ||
                (is_array($replace) && array_search($k, $replace, true) !== false)
            )
            {
                $n['Replace'] = 'true';
            }

            $map['Attribute'][] = $n;
        }
    }

    return $map;
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback