TypeDate
extends AbstractTypeDescriptor
in package
Entity Type Date class
Table of Contents
Properties
- $name : string
- The type's name
- $nullable : bool
- Is this type nullable ?
- $writable : bool
- Is this type writable ?
Methods
- __construct() : mixed
- AbstractTypeDescriptor constructor
- emptyIsNull() : bool
- Get true if we consider null an empty input string
- formatSqlValue() : mixed
- Format programming value into SQL value
- formatUserValue() : string
- Format programming value into user value
- getHtmlInputAttr() : array<string|int, string>
- Get the html input attributes array for the given Field descriptor
- getName() : string
- Get the type name
- htmlInputAttr() : string
- Get the html input attributes string for the given args
- isNullable() : bool
- Get true if field is nullable
- isWritable() : bool
- Get true if field is writable
- parseArgs() : stdClass
- Parse args from field declaration
- parseSqlValue() : Date|null
- Parse SQL value into programming value
- parseUserValue() : Date
- Parse user value into programming value
- preFormat() : void
- Format value before being validated.
- validate() : void
- Validate value This should handle a string and the final type, e.g. DateTime for TypeDatetime
Properties
$name
The type's name
protected
string
$name
$nullable
Is this type nullable ?
protected
bool
$nullable
= false
$writable
Is this type writable ?
protected
bool
$writable
= true
Methods
__construct()
AbstractTypeDescriptor constructor
public
__construct(string $name) : mixed
Parameters
- $name : string
emptyIsNull()
Get true if we consider null an empty input string
public
emptyIsNull(FieldDescriptor $field) : bool
Parameters
- $field : FieldDescriptor
Return values
boolformatSqlValue()
Format programming value into SQL value
public
formatSqlValue(FieldDescriptor $field, string $value) : mixed
Parameters
- $field : FieldDescriptor
-
The field to parse
- $value : string
-
The field value to parse
Tags
Return values
mixed —(string, null or any special type)
formatUserValue()
Format programming value into user value
public
formatUserValue(FieldDescriptor $field, mixed $value) : string
Parameters
- $field : FieldDescriptor
-
The field to parse
- $value : mixed
-
The field value to parse
Tags
Return values
stringgetHtmlInputAttr()
Get the html input attributes array for the given Field descriptor
public
getHtmlInputAttr(FieldDescriptor $field) : array<string|int, string>
Parameters
- $field : FieldDescriptor
Return values
array<string|int, string>getName()
Get the type name
public
getName() : string
Return values
string —the type name
htmlInputAttr()
Get the html input attributes string for the given args
public
htmlInputAttr(object $args) : string
Parameters
- $args : object
Return values
stringisNullable()
Get true if field is nullable
public
isNullable() : bool
Return values
boolisWritable()
Get true if field is writable
public
isWritable() : bool
Return values
boolparseArgs()
Parse args from field declaration
public
parseArgs(array<string|int, string> $rawArgs) : stdClass
Parameters
- $rawArgs : array<string|int, string>
-
Arguments
Return values
stdClassparseSqlValue()
Parse SQL value into programming value
public
parseSqlValue(FieldDescriptor $field, string $value) : Date|null
Parameters
- $field : FieldDescriptor
-
The field to parse
- $value : string
Tags
Return values
Date|nullparseUserValue()
Parse user value into programming value
public
parseUserValue(FieldDescriptor $field, string $value) : Date
Parameters
- $field : FieldDescriptor
-
The field to parse
- $value : string
-
The field value to parse
Tags
Return values
DatepreFormat()
Format value before being validated.
public
preFormat(FieldDescriptor $field, mixed &$value, array<string|int, mixed> $input, PermanentEntity|null &$ref) : void
Validator should allow string and final type (string, object...) Use this function if user/developer could try to validate a validator from another type
Parameters
- $field : FieldDescriptor
-
The field to format
- $value : mixed
-
The field value to format
- $input : array<string|int, mixed>
-
The input to validate
- $ref : PermanentEntity|null
-
The object to update, may be null
validate()
Validate value This should handle a string and the final type, e.g. DateTime for TypeDatetime
public
validate(FieldDescriptor $field, string &$value, array<string|int, mixed> $input, PermanentEntity|null &$ref) : void
Parameters
- $field : FieldDescriptor
-
The field to validate
- $value : string
-
The field value to validate
- $input : array<string|int, mixed>
-
The input to validate
- $ref : PermanentEntity|null
-
The object to update, may be null