Menu

## SQLColumn
in package

SQLColumn.php : 36

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

see
  TableDescriptor
internal

### 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

SQLColumn.php : 83
`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

SQLColumn.php : 56
`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

SQLColumn.php : 47
`public bool $isCustomAjax = false`

#### $isManyToOne

SQLColumn.php : 45
`public bool $isManyToOne = false`

#### $label

SQLColumn.php : 39
`public string $label = null`

#### $name

SQLColumn.php : 38
`public string $name = null`

#### $onLoadCallback

SQLColumn.php : 51
`public callable $onLoadCallback = null`

#### $onSearchCallback

SQLColumn.php : 53
`public callable $onSearchCallback = null`

#### $options

SQLColumn.php : 43
`public array<string|int, mixed> $options = []`

See class description above for options available

#### $type

SQLColumn.php : 40
`public string $type = null`

#### $ajaxOptions

SQLColumn.php : 49
`protected AjaxOptions $ajaxOptions = null`

### Methods

#### __construct()

SQLColumn.php : 113

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()

SQLColumn.php : 220
`public getAjaxOptions() : AjaxOptions`

##### Return values

AjaxOptions —

#### isHidden()

SQLColumn.php : 175

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()

SQLColumn.php : 140

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

throws
  Exception

  if $datatype is not recognized as a valid datatype

internal

##### Return values

string —

the uniform datatype name

#### setAjaxOptions()

SQLColumn.php : 205
`public setAjaxOptions([AjaxOptions $ajaxOptions = null ]) : void`

##### Parameters

$ajaxOptions : AjaxOptions = null

##### Return values

void —

#### triggerOnLoadEvent()

SQLColumn.php : 192
`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()

SQLColumn.php : 199
`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()

SQLColumn.php : 158
`private checkOptions() : mixed`

##### Return values

mixed —

## Search results