PHP

To define PHP as the target language in a template file :

#set( $env.language = 'PHP' )

A "?" is automatically added at the beginning of the type if the attribute is "nullable" (no "@NotNull" annotation). To disable this behavior:

#set( $env.typeWithNullableMark = false )

The information below shows the behavior of the generator when PHP is the current target language. For a detailed description of type conversion, see the generated documentation : https://www.telosys.org/doc/latest/languages/language-php.html

Types conversion

Typed class properties were added in PHP 7.4 ( https://php.watch/versions/7.4/typed-properties )

So since Telosys version 4.1.0, type conversion was added for the PHP language.

Model type
PHP property type
with annotation

string

?string

string

@NotNull

byte

?int int

@NotNull

short

?int int

@NotNull

int

?int int

@NotNull

long

?int int

@NotNull

decimal

?float float

@NotNull

float

?float float

@NotNull

double

?float float

@NotNull

boolean

?bool bool

@NotNull

date

?DateTime DateTime

@NotNull

time

?DateTime DateTime

@NotNull

timestamp

?DateTime DateTime

@NotNull

binary

Literal values

TRUE, FALSE, NULL

PHP literal

TRUE

true

FALSE

false

NULL

null

Last updated