Cassandra\SchemaMetadataIntegrationTest::createKeyspaceWithSchema PHP Method

createKeyspaceWithSchema() protected method

protected createKeyspaceWithSchema ( $keyspaceName, $tableSchemas )
    protected function createKeyspaceWithSchema($keyspaceName, $tableSchemas)
    {
        $this->createKeyspace($keyspaceName);
        foreach ($tableSchemas as $tableName => $tableSchema) {
            $query = sprintf("CREATE TABLE {$keyspaceName}.{$tableName} (%s, PRIMARY KEY(%s))", implode(", ", array_map(function ($key, $value) {
                return "{$key} {$value}";
            }, array_keys($tableSchema), array_values($tableSchema))), implode(", ", array_filter(array_keys($tableSchema), function ($columnName) {
                return strpos($columnName, "key") === 0;
            })));
            $this->session->execute(new SimpleStatement($query));
        }
    }