A class that represents the map type. The map type contains two types that represents the types of the key and value contained in the map.

Extends

Methods

string

name

( )

Returns “map”

Returns:
Type Details
string

“map”

Cassandra\Type

keyType

( )

Returns type of keys

Returns:
Type Details
Cassandra\Type

Cassandra\Type of keys

Cassandra\Type

valueType

( )

Returns type of values

Returns:
Type Details
Cassandra\Type

Cassandra\Type of values

string

__toString

( )

Returns type representation in CQL, e.g. map<varchar, int>

Returns:
Type Details
string

Cassandra\Type representation in CQL

Type\Map

create

( mixed $value )

Creates a new Type\Map from the given values.

<?php
use Type;
use Uuid;

$type = Type::map(Type::uuid(), Type::varchar());
$map = $type->create(new Uuid(), 'first uuid',
                     new Uuid(), 'second uuid',
                     new Uuid(), 'third uuid');

var_dump($map);

is a key and each even value is a value for the map, e.g. create(key, value, key, value). When no values given, creates an empty map.

Parameters:
Name Type Details
$value mixed

An even number of values, where each odd value

Throws:
Type Details
Exception\InvalidArgumentException

when keys or values given are of a different type than what this map type expects.

Returns:
Type Details
Type\Map

A set with given values.