CRUDKit api-doc [Developer]

SQLManyToOneColumn extends SQLColumn
in package

Allows to define Many to One Columns.

Example: Book <> Author. Field "author_id" in table "books" is the Many to One Column.

Tags
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']
$ajax  : bool
$columnName  : string
$filterDefinitions  : array<string|int, FilterDefinition>
$isCustomAjax  : bool
$isManyToOne  : bool
$label  : string
$manualInput  : bool
$name  : string
$onLoadCallback  : callable
$onSearchCallback  : callable
$options  : array<string|int, mixed>
$pageId  : string
$secondaryColumnNames  : array<string|int, string>
$toTableName  : string
$type  : string
$ajaxOptions  : AjaxOptions
__construct()  : mixed
Creates a new Many to One Column
getAjaxOptions()  : AjaxOptions
getCardUrl()  : string
Gets the url to the card page of the related record.
getColumnsForSelect()  : array<string|int, string>
getManyToOneValues()  : array<string|int, mixed>
Gets array of values.
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

$onLoadCallback

public callable $onLoadCallback = null

$onSearchCallback

public callable $onSearchCallback = null

$options

public array<string|int, mixed> $options = []

See class description above for options available

$secondaryColumnNames

public array<string|int, string> $secondaryColumnNames = []

Methods

__construct()

Creates a new Many to One Column

public __construct(string $name, string $label, string $type, string $toTableName, string $columnName[, array<string|int, string> $secondaryColumnNames = [] ][, string $pageId = '' ][, array<string|int, FilterDefinition$filterDefinitions = [] ][, array<string|int, mixed> $options = [] ][, bool $manualInput = false ][, bool $ajax = false ][, array<string|int, mixed> $ajaxOptions = null ]) : mixed
Parameters
$name : string
$label : string
$type : string

See Class SQLColumn for types

$toTableName : string

Curdkit table name

$columnName : string

Primary relations column

$secondaryColumnNames : array<string|int, string> = []

Secondary columns which will be shown to the user (more = slower)

$pageId : string = ''

The drilldown page id

$filterDefinitions : array<string|int, FilterDefinition> = []

(optional) Array of filter definitions to describe the relation.

$options : array<string|int, mixed> = []

(optional) See Class SQLColumn for options

$manualInput : bool = false

Allows the user to input custom data manually (without checking)

$ajax : bool = false

Ajax powered value selection

$ajaxOptions : array<string|int, mixed> = null

Options for the ajax

Tags
see
SQLColumn
Return values
mixed

getCardUrl()

Gets the url to the card page of the related record.

public getCardUrl(array<string|int, mixed> $record) : string
Parameters
$record : array<string|int, mixed>

Record data

Return values
string

getColumnsForSelect()

public getColumnsForSelect(bool $includeAjaxColumns) : array<string|int, string>
Parameters
$includeAjaxColumns : bool
Return values
array<string|int, string>

getManyToOneValues()

Gets array of values.

public getManyToOneValues([array<string|int, mixed> $record = [] ][, bool $onlyCurrentValue = false ]) : array<string|int, mixed>

Will be shown as