Data Types

Type Map

This driver maps CrateDB types to the following PHP types:

CrateDB Type PHP Type  
boolean boolean  
byte integer  
short integer  
integer integer  
long string  
float float  
double float  
string string  
ip string  
timestamp DateTime  
geo_point array  
geo_shape array  
object array  
array array  

Column Type Definitions

When defining CrateDB timestamp, object or array type columns, you must construct the DBAL column definition programatically, using the types and attributes provided by the CrateDB DBAL driver.

Primitive column types (e.g. string, integer, and so on) can be defined in the regular DBAL way.

The custom type objects provided by the CrateDB DBAL driver are:

Here’s an example of how the MapType can be used:

use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Crate\DBAL\Types\MapType;

$table = new Table('test_table');
$objDefinition = array(
  'type' => MapType::STRICT,
   'fields' => array(
     new Column('id',  Type::getType('integer'), array()),
     new Column('name',  Type::getType('string'), array()),
     ),
   );
$table->addColumn(
    'object_column', MapType::NAME,
    array('platformOptions'=>$objDefinition));
$schemaManager->createTable($table);

Here, the MapType class being used to model a CrateDB object. Standard DBAL types, like string, are being used to construct the schema of the object, via calls to the the use of the Column class and calls to the Type::getType static method, and so on.

See also

The Doctrine ORM documentation has more about type mapping.