Cassandra\DatatypeIntegrationTests::createUserType PHP Method

createUserType() public method

Create a user type in the current keyspace
public createUserType ( $userType )
$userType Cassandra\Type\UserType
    public function createUserType($userType)
    {
        $query = "CREATE TYPE IF NOT EXISTS %s (%s)";
        $fieldsString = implode(", ", array_map(function ($name, $type) {
            return "{$name} " . self::typeString($type);
        }, array_keys($userType->types()), $userType->types()));
        $query = sprintf($query, $this->userTypeString($userType), $fieldsString);
        $this->session->execute(new SimpleStatement($query));
    }