PluginYamlModel
extends YamlModel
in package
A base class for models that keep data in the plugin.yaml file.
Tags
Table of Contents
- $exists : bool
- $fillable : mixed
- $originalFileData : mixed
- $originalFilePath : mixed
- $pluginCodeObj : PluginCode
- $pluginName : mixed
- $updatedData : mixed
- $validationMessages : mixed
- $validationRules : mixed
- $yamlSection : string
- deleteModel() : mixed
- fill() : mixed
- getModelPluginName() : mixed
- getPluginCodeObj() : mixed
- getPluginName() : mixed
- initDefaults() : mixed
- isNewModel() : mixed
- loadPlugin() : mixed
- save() : 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
- afterCreate() : mixed
- beforeCreate() : mixed
- getArrayKeySafe() : mixed
- getFilePath() : string
- Returns a file path to save the model to.
- initPropertiesFromPluginCodeObject() : mixed
- load() : mixed
- loadCommonProperties() : mixed
- modelToYamlArray() : array<string|int, mixed>
- Converts the model's data to an array before it's saved to a YAML file.
- pluginSettingsFileExists() : mixed
- validateBeforeCreate() : 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.
$pluginName
protected
mixed
$pluginName
$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 —getModelPluginName()
public
getModelPluginName() : mixed
Return values
mixed —getPluginCodeObj()
public
getPluginCodeObj() : mixed
Return values
mixed —getPluginName()
public
getPluginName() : mixed
Return values
mixed —initDefaults()
public
initDefaults() : mixed
Return values
mixed —isNewModel()
public
isNewModel() : mixed
Return values
mixed —loadPlugin()
public
loadPlugin(mixed $pluginCode) : mixed
Parameters
- $pluginCode : mixed
Return values
mixed —save()
public
save() : 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 —validate()
public
validate() : 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
abstract getFilePath() : string
Return values
string —Returns a path.
initPropertiesFromPluginCodeObject()
protected
initPropertiesFromPluginCodeObject(mixed $pluginCodeObj) : mixed
Parameters
- $pluginCodeObj : mixed
Return values
mixed —load()
protected
load(mixed $filePath) : mixed
Parameters
- $filePath : mixed
Return values
mixed —loadCommonProperties()
protected
loadCommonProperties() : 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> —pluginSettingsFileExists()
protected
static pluginSettingsFileExists(mixed $pluginCodeObj) : mixed
Parameters
- $pluginCodeObj : mixed
Return values
mixed —validateBeforeCreate()
protected
validateBeforeCreate() : 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.