SettingsModel
class SettingsModel extends ModelAction
Settings model extension Based on October/ModelBehaviour Usage: In the model class definition: public $implement = ['System\Actions\SettingsModel']; public $settingsCode = 'owner_extension_settings'; public $settingsFieldsConfig = 'settings_model';
Traits
Extension trait
Properties
string | $configPath | from ConfigMaker | |
protected | $configFileExtension | from ConfigMaker | |
static protected array | $extensionCallbacks | from ExtensionTrait | |
static string | $extendableStaticCalledClass | from ExtensionTrait | |
protected | $extensionHidden | from ExtensionTrait | |
protected Model | $model | from ModelAction | |
protected | $requiredProperties | ||
protected | $recordCode | ||
protected | $fieldConfig | ||
protected | $fieldValues | ||
static private array | $instances |
Methods
Reads the contents of the supplied file and applies it to this object.
Reads the contents of the supplied file and applies it to this object.
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
Guess the package path for the called class.
Guess the package path from a specified class.
Helper method for ::extend()
static method
Constructor
Create an instance of the settings model, intended as a static method
Reset the settings to their defaults, this will delete the record model
Checks if the model has been set up previously, intended as a static method
Returns the raw Model record that stores the settings.
Set a single or array key pair of values, intended as a static method
Helper for getSettingsValue, intended as a static method
Get a single setting value, or return a default value
Set a single setting value, if allowed.
Default values to set for this model, override
Populate the field values from the database record.
Internal save method for the model
Before the model is saved, ensure the record code is set and the jsonable field values
After the model is saved, clear the cached query entry.
Checks if a key is legitimate or should be added to the field value collection
Returns the field configuration used by this model.
Returns a cache key for this record.
Clears the internal memory cache of model instances.
Details
in
ConfigMaker at line 27
array
loadConfig(array $configFile = [], array $requiredConfig = [], null $index = null)
Reads the contents of the supplied file and applies it to this object.
in
ConfigMaker at line 46
array
makeConfig(string|array $configFile, array $requiredConfig = [])
Reads the contents of the supplied file and applies it to this object.
in
ConfigMaker at line 97
array
mergeConfig($configLeft, $configRight)
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
in
ConfigMaker at line 116
string
getConfigPath(string $fileName, mixed $configPath = null)
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
in
ConfigMaker at line 154
string
guessConfigPath(string $suffix = '')
Guess the package path for the called class.
in
ConfigMaker at line 169
string
guessConfigPathFrom(string $class, string $suffix = '')
Guess the package path from a specified class.
in
ExtensionTrait at line 32
extensionApplyInitCallbacks()
No description
in
ExtensionTrait at line 51
static void
extensionExtendCallback(callable $callback)
Helper method for ::extend()
static method
in
ExtensionTrait at line 64
protected
extensionHideField($name)
No description
in
ExtensionTrait at line 69
protected
extensionHideMethod($name)
No description
in
ExtensionTrait at line 74
extensionIsHiddenField($name)
No description
in
ExtensionTrait at line 79
extensionIsHiddenMethod($name)
No description
in
ExtensionTrait at line 84
static
getCalledExtensionClass()
No description
at line 37
__construct(null $model)
Constructor
at line 66
instance()
Create an instance of the settings model, intended as a static method
at line 83
resetDefault()
Reset the settings to their defaults, this will delete the record model
at line 95
bool
isConfigured()
Checks if the model has been set up previously, intended as a static method
at line 104
Model
getSettingsRecord()
Returns the raw Model record that stores the settings.
at line 114
set($key, $value = null)
Set a single or array key pair of values, intended as a static method
at line 126
get($key, $default = null)
Helper for getSettingsValue, intended as a static method
at line 134
getSettingsValue($key, $default = null)
Get a single setting value, or return a default value
at line 149
setSettingsValue($key, $value)
Set a single setting value, if allowed.
at line 161
initSettingsData()
Default values to set for this model, override
at line 168
afterModelFetch()
Populate the field values from the database record.
at line 178
void
saveModelInternal()
Internal save method for the model
at line 188
beforeModelSave()
Before the model is saved, ensure the record code is set and the jsonable field values
at line 200
void
afterModelSave()
After the model is saved, clear the cached query entry.
at line 208
protected
isKeyAllowed($key)
Checks if a key is legitimate or should be added to the field value collection
at line 226
getFieldConfig()
Returns the field configuration used by this model.
at line 238
protected
getCacheKey()
Returns a cache key for this record.
at line 247
static void
clearInternalCache()
Clears the internal memory cache of model instances.