I've found out the problem. The key_validation_class
must be TimeUUIDType if row key will be . The insert function is the following;
class Cassandra
{
// the active connection pool inserted into
private $_connection_pool;
private $_column_family;
private $_config;
public function __construct($_config)
{
$this->_config = $_config;
$this->_connection_pool = null;
$this->_column_family = null;
}
public function connection($key_space)
{
if (is_null($this->_connection_pool)) {
try {
$this->_connection_pool = new ConnectionPool($key_space,
$this->_config['servers']);
} catch(Exception $e) {
echo $e->getMessage();
}
}
return $this;
}
public function insert($column_family, $data = array())
{
if (is_null($this->_column_family)) {
$this->_column_family = new ColumnFamily($this->_connection_pool,
$column_family);
$this->_column_family->insert_format = ColumnFamily::ARRAY_FORMAT;
$this->_column_family->return_format = ColumnFamily::ARRAY_FORMAT;
}
$key = UUID::uuid1();
$raw_data = array();
$i = 0;
foreach ($data as $k => $v)
{
$raw_data[$i][] = $k;
$raw_data[$i][] = $v;
$i++;
}
try {
$this->_column_family->insert($key, $raw_data);
$error = false;
} catch (Exception $e) {
$error = true;
echo $e->getMessage();
}
return array('error' => $error);
}