PHP Класс atk4\data\Reference_One

Наследование: extends Reference
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$dateTimeClass For example, 'DateTime', 'Carbon' etc.
$dateTimeZoneClass For example, 'DateTimeZone', 'Carbon' etc.
$default mixed Default value of field.
$mandatory boolean | string Is field mandatory? By default fields are not mandatory.
$never_persist boolean Setting this to true will never actually store the field in the database. It will action as normal, but will be skipped by update/insert.
$persist_format string For example, for date it can be 'Y-m-d', for datetime - 'Y-m-d H:i:s' etc.
$persist_timezone string For example, 'IST', 'UTC', 'Europe/Riga' etc.
$read_only boolean For example, expressions are read only.
$serialize null | boolean | array Value can be array [$encode_callback, $decode_callback].
$typecast null | boolean | array Value can be array [$typecast_save_callback, $typecast_load_callback].
$ui array By default hasOne relation ID field should be editable in forms, but not visible in grids. UI should respect these flags.

Защищенные свойства (Protected)

Свойство Тип Описание
$join Join | null Points to the join if we are part of one.

Открытые методы

Метод Описание
init ( ) Reference_One will also add a field corresponding to 'our_field' unless it exists of course.
ref ( array $defaults = [] ) : Model If owner model is loaded, then return referenced model with respective record loaded.

Защищенные методы

Метод Описание
referenceOurValue ( ) : Field Returns our field or id field.

Описание методов

init() публичный Метод

Reference_One will also add a field corresponding to 'our_field' unless it exists of course.
public init ( )

ref() публичный Метод

If owner model is not loaded, then return referenced model with condition set. This can happen in case of deep traversal $m->ref('Many')->ref('one_id'), for example.
public ref ( array $defaults = [] ) : Model
$defaults array Properties
Результат Model

referenceOurValue() защищенный Метод

Returns our field or id field.
protected referenceOurValue ( ) : Field
Результат Field

Описание свойств

$dateTimeClass публичное свойство

For example, 'DateTime', 'Carbon' etc.
public $dateTimeClass

$dateTimeZoneClass публичное свойство

For example, 'DateTimeZone', 'Carbon' etc.
public $dateTimeZoneClass

$default публичное свойство

Default value of field.
public mixed $default
Результат mixed

$join защищенное свойство

Points to the join if we are part of one.
protected Join,atk4\data|null $join
Результат Join | null

$mandatory публичное свойство

Is field mandatory? By default fields are not mandatory.
public bool|string $mandatory
Результат boolean | string

$never_persist публичное свойство

Setting this to true will never actually store the field in the database. It will action as normal, but will be skipped by update/insert.
public bool $never_persist
Результат boolean

$persist_format публичное свойство

For example, for date it can be 'Y-m-d', for datetime - 'Y-m-d H:i:s' etc.
public string $persist_format
Результат string

$persist_timezone публичное свойство

For example, 'IST', 'UTC', 'Europe/Riga' etc.
public string $persist_timezone
Результат string

$read_only публичное свойство

For example, expressions are read only.
public bool $read_only
Результат boolean

$serialize публичное свойство

Value can be array [$encode_callback, $decode_callback].
public null|bool|array $serialize
Результат null | boolean | array

$typecast публичное свойство

Value can be array [$typecast_save_callback, $typecast_load_callback].
public null|bool|array $typecast
Результат null | boolean | array

$ui публичное свойство

By default hasOne relation ID field should be editable in forms, but not visible in grids. UI should respect these flags.
public array $ui
Результат array