Documentation

ModelYamlModel extends YamlModel
in package

A base class for models belonging to databse models (forms, lists, etc.).

Tags
author

Alexey Bobkov, Samuel Georges

Table of Contents

$exists  : bool
$fileName  : mixed
$fillable  : mixed
$modelClassName  : mixed
$originalFileData  : mixed
$originalFilePath  : mixed
$pluginCodeObj  : PluginCode
$updatedData  : mixed
$validationMessages  : mixed
$validationRules  : mixed
$yamlSection  : string
deleteModel()  : mixed
fill()  : mixed
getDisplayName()  : mixed
Returns a string suitable for displaying in the Builder UI tabs.
getModelPluginName()  : mixed
getPluginCodeObj()  : mixed
getPluginRegistryData()  : mixed
getPluginRegistryDataAllRecords()  : mixed
initDefaults()  : mixed
isNewModel()  : mixed
listModelFiles()  : mixed
save()  : mixed
setModelClassName()  : mixed
setPluginCode()  : mixed
Sets a string code of a plugin the model is associated with
setPluginCodeObj()  : mixed
Sets a code object of a plugin the model is associated with
validate()  : mixed
validateFileIsModelType()  : mixed
addExtension()  : mixed
afterCreate()  : mixed
beforeCreate()  : mixed
getArrayKeySafe()  : mixed
getFilePath()  : string
Returns a file path to save the model to.
getModelClassName()  : mixed
load()  : mixed
modelToYamlArray()  : array<string|int, mixed>
Converts the model's data to an array before it's saved to a YAML file.
validateBeforeCreate()  : mixed
validateModelClassName()  : mixed
yamlArrayToModel()  : mixed
Load the model's data from an array.

Properties

$exists

public bool $exists = false

This property is used by the system internally.

$fillable

protected static mixed $fillable = []

$originalFileData

protected mixed $originalFileData = []

$originalFilePath

protected mixed $originalFilePath

$pluginCodeObj

protected PluginCode $pluginCodeObj = null

The plugin code object the model is associated with.

$updatedData

protected mixed $updatedData = []

$validationMessages

protected mixed $validationMessages = []

$validationRules

protected mixed $validationRules = []

$yamlSection

protected string $yamlSection

Section in the YAML file to save the data into. If empty, the model contents uses the entire file.

Methods

deleteModel()

public deleteModel() : mixed
Return values
mixed

fill()

public fill(array<string|int, mixed> $attributes) : mixed
Parameters
$attributes : array<string|int, mixed>
Return values
mixed

getDisplayName()

Returns a string suitable for displaying in the Builder UI tabs.

public getDisplayName(mixed $nameFallback) : mixed
Parameters
$nameFallback : mixed
Return values
mixed

getModelPluginName()

public getModelPluginName() : mixed
Return values
mixed

getPluginCodeObj()

public getPluginCodeObj() : mixed
Return values
mixed

getPluginRegistryData()

public static getPluginRegistryData(mixed $pluginCode, mixed $modelClassName) : mixed
Parameters
$pluginCode : mixed
$modelClassName : mixed
Return values
mixed

getPluginRegistryDataAllRecords()

public static getPluginRegistryDataAllRecords(mixed $pluginCode) : mixed
Parameters
$pluginCode : mixed
Return values
mixed

initDefaults()

public initDefaults() : mixed
Return values
mixed

isNewModel()

public isNewModel() : mixed
Return values
mixed

listModelFiles()

public static listModelFiles(mixed $pluginCodeObj, mixed $modelClassName) : mixed
Parameters
$pluginCodeObj : mixed
$modelClassName : mixed
Return values
mixed

save()

public save() : mixed
Return values
mixed

setModelClassName()

public setModelClassName(mixed $className) : mixed
Parameters
$className : mixed
Return values
mixed

setPluginCode()

Sets a string code of a plugin the model is associated with

public setPluginCode(string $code) : mixed
Parameters
$code : string

Specifies the plugin code

Return values
mixed

setPluginCodeObj()

Sets a code object of a plugin the model is associated with

public setPluginCodeObj(PluginCode $obj) : mixed
Parameters
$obj : PluginCode

Specifies the plugin code object

Return values
mixed

validateFileIsModelType()

public static validateFileIsModelType(mixed $fileContentsArray) : mixed
Parameters
$fileContentsArray : mixed
Return values
mixed

addExtension()

protected addExtension(mixed $fileName) : mixed
Parameters
$fileName : mixed
Return values
mixed

afterCreate()

protected afterCreate() : mixed
Return values
mixed

beforeCreate()

protected beforeCreate() : mixed
Return values
mixed

getArrayKeySafe()

protected getArrayKeySafe(mixed $array, mixed $key[, mixed $default = null ]) : mixed
Parameters
$array : mixed
$key : mixed
$default : mixed = null
Return values
mixed

getFilePath()

Returns a file path to save the model to.

protected getFilePath() : string
Return values
string

Returns a path.

getModelClassName()

protected getModelClassName() : mixed
Return values
mixed

load()

protected load(mixed $filePath) : mixed
Parameters
$filePath : mixed
Return values
mixed

modelToYamlArray()

Converts the model's data to an array before it's saved to a YAML file.

protected abstract modelToYamlArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

validateBeforeCreate()

protected validateBeforeCreate() : mixed
Return values
mixed

validateModelClassName()

protected static validateModelClassName(mixed $modelClassName) : mixed
Parameters
$modelClassName : mixed
Return values
mixed

yamlArrayToModel()

Load the model's data from an array.

protected abstract yamlArrayToModel(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>

An array to load the model fields from.

Return values
mixed

Search results