How to map a single char column in Doctrine 2

Doctrine doesn't have a CHAR type defined out of the box, however it does allow you to define custom types, which you could use to create a 'char' type to use in annotations.

The Doctrine documentation has an example of this: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#custom-mapping-types


You can always use the string type with the fixed option:

/**
 * @Column(type="string", length=2, options={"fixed" = true})
 */
protected $country;

The above code snippet produces the following SQL:

`country` char(2) NOT NULL,