"PHP" language specificities

Telosys version : 4.3.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
timetz ?DateTime ?DateTime DateTime ?DateTime ?DateTime
datetime ?DateTime ?DateTime DateTime ?DateTime ?DateTime
datetimetz ?DateTime ?DateTime DateTime ?DateTime ?DateTime
timestamp ?DateTime ?DateTime DateTime ?DateTime ?DateTime
uuid ?string ?string string ?string ?string
binary ?string ?string string ?string ?string

Remarks

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 new DateTime('2001-06-22')
date DateTime DateTime new DateTime('2001-06-22')
time ?DateTime ?DateTime new DateTime('01:46:52')
time DateTime DateTime new DateTime('01:46:52')
timetz ?DateTime ?DateTime new DateTime('01:46:52+01:00')
timetz DateTime DateTime new DateTime('01:46:52+01:00')
datetime ?DateTime ?DateTime new DateTime('2001-05-21T01:47:53')
datetime DateTime DateTime new DateTime('2001-05-21T01:47:53')
datetimetz ?DateTime ?DateTime new DateTime('2001-05-21T01:47:53+01:00')
datetimetz DateTime DateTime new DateTime('2001-05-21T01:47:53+01:00')
timestamp ?DateTime ?DateTime new DateTime('2001-05-21T01:47:53')
timestamp DateTime DateTime new DateTime('2001-05-21T01:47:53')
uuid ?string ?string '88ebcf85-9bbf-4681-b52a-b83b66528110'
uuid string string 'f2d7ccb2-178b-4e1f-b855-eefccea1306d'
binary ?string ?string null
binary string string null