Represent a field of a DAO object / Database column
package | salt\dao |
---|
displayOptions(array<mixed,mixed> $options) : \salt\Field
array<mixed,mixed>
parameters to use for displaying the field with FORM. key=>value
\salt\Field
this objectisDate() : boolean
boolean
TRUE if the field is a datenewBoolean(string $name, string $text, boolean $nullable= FALSE
, mixed $defaultValue= NULL
, string $useName= NULL
)
string
column name
string
literal description of the column.
boolean
(optional, FALSE) TRUE if the field can be NULL : set an empty string for set a NULL. Explicit set EMPTY_STRING for set an empty string
mixed
(optional, NULL) default value for new created object
string
(optional, NULL) in case $name is a reserved word, $useName will be used instead for DAO (obviously $name is still used in query SQL text)
newClone(string $name= NULL
, string $text= NULL
, string $nullable= NULL
, string $defaultValue= NULL
, string $values= NULL
) : \salt\Field
string
the new name
string
the new text
string
the new value for nullable behavior
string
the new default value
string
the new values list
\salt\Field
a new instance of Field with parametersnewDate(string $name, string $text, string $sqlFormat, string $displayFormat= DEFAULT_DATE_DISPLAY_FORMAT
, boolean $nullable= FALSE
, mixed $defaultValue= NULL
, string $useName= NULL
)
string
column name
string
literal description of the column.
string
(optional, NULL) SqlDateFormat or Mysql date format for date type field
string
(optional, DEFAULT_DATE_DISPLAY_FORMAT) PHP date() format for display date type field
boolean
(optional, FALSE) TRUE if the field can be NULL : set an empty string for set a NULL. Explicit set EMPTY_STRING for set an empty string
mixed
(optional, NULL) default value for new created object
string
(optional, NULL) in case $name is a reserved word, $useName will be used instead for DAO (obviously $name is still used in query SQL text)
newNumber(string $name, string $text, boolean $nullable= FALSE
, integer $defaultValue= NULL
, array<mixed,mixed> $values= array()
, string $useName= NULL
)
string
column name
string
literal description of the column. Displayed in column header
boolean
(optional, FALSE) TRUE if the field can be NULL : set an empty string for set a NULL. Explicit set EMPTY_STRING for set an empty string
integer
(optional, NULL) default value for new created object
array<mixed,mixed>
(optional, array()) List of all possible values for the field : number => mixed
string
(optional, NULL) in case $name is a reserved word, $useName will be used instead for DAO (obviously $name is still used in query SQL text)
newText(string $name, string $text, boolean $nullable= FALSE
, mixed $defaultValue= NULL
, array<mixed,mixed> $values= array()
, string $useName= NULL
)
string
column name
string
literal description of the column.
boolean
(optional, FALSE) TRUE if the field can be NULL : set an empty string for set a NULL. Explicit set EMPTY_STRING for set an empty string
mixed
(optional, NULL) default value for new created object
array<mixed,mixed>
(optional, array()) List of all possible values for the field
string
(optional, NULL) in case $name is a reserved word, $useName will be used instead for DAO (obviously $name is still used in query SQL text)
sqlType(string $sqlType) : \salt\Field
string
SQL type with lenght and other options : primary, unique, auto_increment, etc...
\salt\Field
this objectvalidate(mixed $value)
mixed
\salt\SaltException |
if $value is not valid. |
---|
__construct(string $name, string $text, integer $type, boolean $nullable= FALSE
, mixed $defaultValue= NULL
, array<mixed,mixed> $values= array()
, string $sqlFormat= NULL
, string $displayFormat= DEFAULT_DATE_DISPLAY_FORMAT
, string $useName= NULL
)
..() for that
string
column name
string
literal description of the column.
integer
FieldType type of the field
boolean
(optional, FALSE) TRUE if the field can be NULL : set an empty string for set a NULL. Explicit set EMPTY_STRING for set an empty string
mixed
(optional, NULL) default value for new created object
array<mixed,mixed>
(optional, array()) List of all possible values for the field
string
(optional, NULL) SqlDateFormat or Mysql date format for date type field
string
(optional, DEFAULT_DATE_DISPLAY_FORMAT) PHP date() format for display date type field
string
(optional, NULL) in case $name is a reserved word, $useName will be used instead for DAO (obviously $name is still used in query SQL text)
checkMetadata()
\salt\SaltException |
if metadata are not valid |
---|
$defaultValue : mixed
NULL
$displayOptions : array<mixed,mixed>
array()
$format : string
NULL
$name : string
$nullable : boolean
FALSE
$sqlType : string
NULL
$text : string
$type : integer
$useName : string
NULL
$values : array<mixed,mixed>
array()
content | value => text |
---|
$BASE_FIELDS : array<mixed,string>
array('FORM', 'VIEW', 'COLUMN', 'SQL')
$RESERVED_FIELDS : array<mixed,string>
NULL
EMPTY_STRING = "\1EMPTY_STRING\2"