Understanding Doctrine Mapping Types

Doctrine Mapping Types used in the @Column annotation are neither SQL types nor PHP types but they are mapped to both. For instance, the Doctrine text type will be casted to the string PHP type in the entity and stored in a database column with the CLOB type.

The following is a correspondence table for Doctrine Mapping Type of PHP type and SQL type:

Doctrine Mapping Type

PHP Type

SQL Type

string

string

VARCHAR

integer

integer

INT

smallint

integer

SMALLINT

bigint

string

BIGINT

boolean

boolean

BOOLEAN

decimal

double

DECIMAL

date

\DateTime

DATETIME

time

\DateTime

TIME

datetime

\DateTime

DATETIME or TIMESTAMP

text

string

Get Persistence in PHP with Doctrine ORM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.