SQLColumn
in package
Represents a column in a table.
Valid $option values:
['required'] (bool) --> Makes this field marked as required for the user.
['enum'] (array) --> Value/Label array for enum values
['max'] (int) --> Maximum text lenght/number value.
['min'] (int) --> Minimum text lenght/number value.
['tooltip'] (string) --> Shows a tooltip with this info to the user.
['description'] --> Adds an extended description to the label
['suffix'] (string) --> Appends this suffix after the actual value in views. (Example "€" sign behind prices)
['step'] (string) --> Digits for decimal columns. Default = 0.01
['email'] (bool) --> Shows field als mailto: link
['link'] (bool) --> Shows field as <a> link
['textarea'] (bool) --> Displays the fields as a textarea if possible
['readonly'] (bool) --> This field is readonly for the user.
['hidden'] (bool) --> This field is hidden on all pages [default: false]
['list'] (bool) --> Show this field on list pages [default: true]
['card'] (bool) --> Show this field on card pages [default: true]
['create'] (bool) --> Show this field on create card pages [default: true]
['update'] (bool) --> Show this field update card pages [default: true]
['imageUrl'] (bool) --> Show this field as an image (per hyperlink)
Tags
Table of Contents
- VALID_OPTIONS = ['required', 'enum', 'max', 'min', 'tooltip', 'description', 'suffix', 'step', 'email', 'link', 'textarea', 'readonly', 'hidden', 'list', 'card', 'create', 'update', 'url', 'imageUrl']
- VALID_TYPES = ['text' => 'text', 'string' => 'text', 'integer' => 'integer', 'bigint' => 'integer', 'biginteger' => 'integer', 'smallint' => 'integer', 'int' => 'integer', 'decimal' => 'decimal', 'dec' => 'decimal', 'double' => 'decimal', 'float' => 'decimal', 'enum' => 'enum', 'datetime' => 'datetime', 'date' => 'date', 'time' => 'time', 'boolean' => 'boolean', 'bool' => 'boolean', 'tinyint' => 'boolean', 'blob' => 'blob', 'binary' => 'blob', 'bin' => 'blob', 'image' => 'image', 'picture' => 'image']
- $isCustomAjax : bool
- $isManyToOne : bool
- $label : string
- $name : string
- $onLoadCallback : callable
- $onSearchCallback : callable
- $options : array<string|int, mixed>
- $type : string
- $ajaxOptions : AjaxOptions
- __construct() : mixed
- Constructor
- getAjaxOptions() : AjaxOptions
- isHidden() : bool
- Checks if the column is hidden (in general or on a specific page type.)
- mapDatatype() : string
- Maps various names for datatypes to a uniform name.
- setAjaxOptions() : void
- triggerOnLoadEvent() : mixed
- triggerOnSearchEvent() : mixed
- checkOptions() : mixed
Constants
VALID_OPTIONS
public
mixed
VALID_OPTIONS
= ['required', 'enum', 'max', 'min', 'tooltip', 'description', 'suffix', 'step', 'email', 'link', 'textarea', 'readonly', 'hidden', 'list', 'card', 'create', 'update', 'url', 'imageUrl']
VALID_TYPES
public
array<string|int, string>
VALID_TYPES
= ['text' => 'text', 'string' => 'text', 'integer' => 'integer', 'bigint' => 'integer', 'biginteger' => 'integer', 'smallint' => 'integer', 'int' => 'integer', 'decimal' => 'decimal', 'dec' => 'decimal', 'double' => 'decimal', 'float' => 'decimal', 'enum' => 'enum', 'datetime' => 'datetime', 'date' => 'date', 'time' => 'time', 'boolean' => 'boolean', 'bool' => 'boolean', 'tinyint' => 'boolean', 'blob' => 'blob', 'binary' => 'blob', 'bin' => 'blob', 'image' => 'image', 'picture' => 'image']
Mapping datatye <> Datatype in database. Exampe dec = decimal, float = decimal
Properties
$isCustomAjax
public
bool
$isCustomAjax
= false
$isManyToOne
public
bool
$isManyToOne
= false
$label
public
string
$label
= null
$name
public
string
$name
= null
$onLoadCallback
public
callable
$onLoadCallback
= null
$onSearchCallback
public
callable
$onSearchCallback
= null
$options
public
array<string|int, mixed>
$options
= []
See class description above for options available
$type
public
string
$type
= null
$ajaxOptions
protected
AjaxOptions
$ajaxOptions
= null
Methods
__construct()
Constructor
public
__construct(string $name, string $label, string $type[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $name : string
- $label : string
- $type : string
- $options : array<string|int, mixed> = []
-
(optional)
Return values
mixed —getAjaxOptions()
public
getAjaxOptions() : AjaxOptions
Return values
AjaxOptions —isHidden()
Checks if the column is hidden (in general or on a specific page type.)
public
isHidden([string $pageType = '' ]) : bool
Parameters
- $pageType : string = ''
-
Valid page types are: '','list','card','create','update' ('' = all pages)
Return values
bool —mapDatatype()
Maps various names for datatypes to a uniform name.
public
static mapDatatype(string $datatype[, string $columnName = '' ]) : string
Example: string, text = text
Example: int, integer, bigint = integer
Parameters
- $datatype : string
-
The name of the datatype
- $columnName : string = ''
-
The name of the column for a more precise exception message, if needed.
Tags
Return values
string —the uniform datatype name
setAjaxOptions()
public
setAjaxOptions([AjaxOptions $ajaxOptions = null ]) : void
Parameters
- $ajaxOptions : AjaxOptions = null
Return values
void —triggerOnLoadEvent()
public
triggerOnLoadEvent(mixed &$value, mixed $record, TableDescriptor $table, PageDescriptor $page, SQLColumn $column) : mixed
Parameters
- $value : mixed
- $record : mixed
- $table : TableDescriptor
- $page : PageDescriptor
- $column : SQLColumn
Return values
mixed —triggerOnSearchEvent()
public
triggerOnSearchEvent(mixed &$results, mixed $input, TableDescriptor $table, PageDescriptor $page, SQLColumn $column) : mixed
Parameters
- $results : mixed
- $input : mixed
- $table : TableDescriptor
- $page : PageDescriptor
- $column : SQLColumn
Return values
mixed —checkOptions()
private
checkOptions() : mixed