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\Fieldthis objectisDate() : boolean
booleanTRUE if the field is a datenewBoolean(string $name, string $text, boolean $nullable= FALSE, mixed $defaultValue= NULL, string $useName= NULL)
stringcolumn name
stringliteral 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
stringthe new name
stringthe new text
stringthe new value for nullable behavior
stringthe new default value
stringthe new values list
\salt\Fielda 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)
stringcolumn name
stringliteral 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)
stringcolumn name
stringliteral 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)
stringcolumn name
stringliteral 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
stringSQL type with lenght and other options : primary, unique, auto_increment, etc...
\salt\Fieldthis 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
stringcolumn name
stringliteral description of the column.
integerFieldType 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>
NULLEMPTY_STRING = "\1EMPTY_STRING\2"