"PHP" language specificities

Telosys version : 4.1.0

To define PHP as the target language call  #set( $env.language = 'PHP' )  in the templates files.

The information below shows the behavior of the generator when 'PHP' is the current target language.

Type conversion ( model type to language type )

The language type conversion has an impact on :
Model type     Default        @UnsignedType @NotNull       @PrimitiveType @ObjectType   
string ?string ?string string ?string ?string
byte ?int ?int int ?int ?int
short ?int ?int int ?int ?int
int ?int ?int int ?int ?int
long ?int ?int int ?int ?int
decimal ?float ?float float ?float ?float
float ?float ?float float ?float ?float
double ?float ?float float ?float ?float
boolean ?bool ?bool bool ?bool ?bool
date ?DateTime ?DateTime DateTime ?DateTime ?DateTime
time ?DateTime ?DateTime DateTime ?DateTime ?DateTime
timestamp ?DateTime ?DateTime DateTime ?DateTime ?DateTime


Typed class properties have been added in PHP 7.4
Telosys returns the type usable for class properties

Literals for TRUE, FALSE and NULL

TRUE true
FALSE false
NULL null

Literal values

Model type Language type Language full type Language literal value example
string ?string ?string "AAA"
string string string "AAA"
byte ?int ?int 1
byte int int 1
short ?int ?int 1
short int int 1
int ?int ?int 100
int int int 100
long ?int ?int 1000
long int int 1000
decimal ?float ?float 10000.77
decimal float float 10000.77
float ?float ?float 1000.5
float float float 1000.5
double ?float ?float 1000.66
double float float 1000.66
boolean ?bool ?bool true
boolean bool bool true
date ?DateTime ?DateTime null
date DateTime DateTime null
time ?DateTime ?DateTime null
time DateTime DateTime null
timestamp ?DateTime ?DateTime null
timestamp DateTime DateTime null
binary null