Documentation

Storage
in package

Storage class

This class represents a storage configuration

Table of Contents

Properties

$accessPoint  : DataAccessPoint
$fields  : object
$isShowDeletedRows  : bool
$isSoftDelete  : bool
$levels  : bool
$name  : string
$settings  : array<string|int, mixed>
$table  : string
$_dataPoint  : DataAccessPoint|null
Data access point
$_fields  : object
Fields list
$_name  : string
Storage Name
$_xstorage  : array<string|int, mixed>
Internal storage data

Methods

__construct()  : mixed
Constructs a new Storage object.
__get()  : mixed
Getter method.
__set()  : void
Setter method.
AddField()  : Field
Adds a new field to the storage.
AddIndex()  : void
Adds an index to the storage.
Create()  : Storage
Creates a new instance of the Storage class.
Delete()  : void
Deletes the storage settings from config of module or application.
DeleteField()  : void
Deletes a field from the storage.
DeleteIndex()  : void
Deletes an index from the storage.
DisableKeys()  : void
Disables keys for the storage table.
EnableKeys()  : void
Enables keys for the storage table.
GetField()  : Field|null
Retrieves a field object based on the specified path like field1/field2/field3 if field1 and field2 is of type json
GetFieldClass()  : string
Retrieves the class of a specific field.
GetFieldName()  : string
Retrieves the field name without the table prefix.
GetModelClasses()  : array<string|int, mixed>
Retrieves the model classes for the storage.
GetModule()  : Module|null
Retrieves the module associated with the storage.
GetRealFieldName()  : string
Retrieves the real field name with the table prefix.
GetStatus()  : object
Retrieves the status of the storage.
GetTemplates()  : object|array<string|int, mixed>
Retrieves templates for displaying records from the storage.
MoveField()  : void
Moves a field within the storage.
Save()  : void
Saves the storage settings to a file.
ToArray()  : array<string|int, mixed>
Converts the storage settings to an array.
UpdateField()  : void
Updates a field in the storage configuration.
_init()  : void
Initializes the storage object.
_loadFields()  : void
Loads fields into an array.

Properties

$accessPoint read-only

public DataAccessPoint $accessPoint

The DataAccessPoint object associated with the storage.

$fields read-only

public object $fields

The list of fields associated with the storage.

$isShowDeletedRows read-only

public bool $isShowDeletedRows

Indicates whether the deleted rows must be shown or not

$isSoftDelete read-only

public bool $isSoftDelete

Indicates whether the rows is not deleted but marked as deleted

$levels read-only

public bool $levels

Indicates whether the storage supports levels.

$name read-only

public string $name

The name of the storage.

$settings read-only

public array<string|int, mixed> $settings

The settings array containing various configuration options.

$table read-only

public string $table

The name of the database table associated with the storage.

$_fields

Fields list

private object $_fields

$_name

Storage Name

private string $_name

$_xstorage

Internal storage data

private array<string|int, mixed> $_xstorage

Methods

__construct()

Constructs a new Storage object.

public __construct(array<string|int, mixed>|object $xstorage[, string|null $name = null ]) : mixed
Parameters
$xstorage : array<string|int, mixed>|object

The data from the storage settings.

$name : string|null = null

The name of the storage.

__get()

Getter method.

public __get(string $prop) : mixed

Retrieves the value of the specified property.

Parameters
$prop : string

The name of the property to retrieve.

Return values
mixed

The value of the specified property.

__set()

Setter method.

public __set(string $prop, mixed $value) : void

Sets the value of the specified property.

Parameters
$prop : string

The name of the property to set.

$value : mixed

The value to set.

AddField()

Adds a new field to the storage.

public AddField(string $path, array<string|int, mixed> $data) : Field
Parameters
$path : string

The path to the field.

$data : array<string|int, mixed>

The data for the new field.

Return values
Field

The newly created field object.

AddIndex()

Adds an index to the storage.

public AddIndex(string $name, array<string|int, mixed> $data) : void
Parameters
$name : string

The name of the index.

$data : array<string|int, mixed>

The index data.

Create()

Creates a new instance of the Storage class.

public static Create(Module $module[, string $name = '' ][, array<string|int, mixed> $data = [] ]) : Storage

This method is a factory method used to create a new Storage object. It allows creating a Storage object with the provided module, name, and data.

For example

$storage = Storage::Create(App::$moduleManager->{'lang'}, 'langs');

its equivalent of

$storage = Storages::Create()->Load('langs', 'lang');
Parameters
$module : Module

The module instance.

$name : string = ''

The name of the storage.

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

Additional data for configuring the storage.

Tags
example
Return values
Storage

The newly created Storage object.

Delete()

Deletes the storage settings from config of module or application.

public Delete() : void

DeleteField()

Deletes a field from the storage.

public DeleteField(string $path) : void
Parameters
$path : string

The path to the field.

DeleteIndex()

Deletes an index from the storage.

public DeleteIndex(string $name) : void
Parameters
$name : string

The name of the index.

DisableKeys()

Disables keys for the storage table.

public DisableKeys() : void
Tags
deprecated

EnableKeys()

Enables keys for the storage table.

public EnableKeys() : void
Tags
deprecated

GetField()

Retrieves a field object based on the specified path like field1/field2/field3 if field1 and field2 is of type json

public GetField(string $path) : Field|null
Parameters
$path : string

The path to the field (e.g., 'fieldname/subfieldname').

Return values
Field|null

The field object, or null if not found.

GetFieldClass()

Retrieves the class of a specific field.

public GetFieldClass(Field $field) : string
Parameters
$field : Field

The field object.

Tags
throws
AppException

If the class of the field is unknown.

Return values
string

The class name of the field.

GetFieldName()

Retrieves the field name without the table prefix.

public GetFieldName(string $name) : string
Parameters
$name : string

The name of the field with the prefix.

Return values
string

The name of the field without the prefix.

GetModelClasses()

Retrieves the model classes for the storage.

public GetModelClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array containing the table class and row class.

GetModule()

Retrieves the module associated with the storage.

public GetModule() : Module|null
Return values
Module|null

The module object, or null if not found.

GetRealFieldName()

Retrieves the real field name with the table prefix.

public GetRealFieldName(string $name) : string
Parameters
$name : string

The name of the field without the prefix.

Return values
string

The name of the field with the prefix.

GetStatus()

Retrieves the status of the storage.

public GetStatus() : object
Return values
object

The storage status.

GetTemplates()

Retrieves templates for displaying records from the storage.

public GetTemplates() : object|array<string|int, mixed>
Return values
object|array<string|int, mixed>

The templates data.

MoveField()

Moves a field within the storage.

public MoveField(Field $field, Field $relative, string $sibling) : void
Parameters
$field : Field

The field to move.

$relative : Field

The relative field.

$sibling : string

The sibling position ('before' or 'after').

Save()

Saves the storage settings to a file.

public Save([bool $performValidationBeforeSave = false ]) : void
Parameters
$performValidationBeforeSave : bool = false

this parameter is dummy

ToArray()

Converts the storage settings to an array.

public ToArray([bool $changeLang = true ]) : array<string|int, mixed>
Parameters
$changeLang : bool = true

Whether to change the language or not.

Return values
array<string|int, mixed>

The storage settings as an array.

UpdateField()

Updates a field in the storage configuration.

public UpdateField(Field $field) : void

This method updates the configuration of a specific field in the storage object.

Parameters
$field : Field

The field object to update.

_init()

Initializes the storage object.

private _init() : void

This method sets up the name, data access point, and loads fields for the storage.

_loadFields()

Loads fields into an array.

private _loadFields() : void

This method initializes the fields of the storage object from the stored configuration.


        
On this page

Search results