www.hubleto.eu Reddit User Guide Stack Overflow LinkedIn Community Report an issue

Model for storing list of user roles. Stored in 'roles' SQL table.

\Hubleto\Framework\Models\UserRole

Parent class\Hubleto\Framework\Model

Constants

Constant Visibility Type Value
ADMINISTRATOR public 1
USER_ROLES public [self::ADMINISTRATOR => 'ADMINISTRATOR']

Properties

 
### ☍ recordManagerClass ```php public string $recordManagerClass ```
 
### ☍ table ```php public string $table ```
 
### ☍ lookupSqlValue ```php public ?string $lookupSqlValue ```

SQL-compatible string used to render displayed value of the record when used as a lookup.

Methods

ƒ describeColumns

[Description for describeColumns]

public describeColumns(): array

Inherited methods

ƒ __construct

public __construct(): mixed

ƒ setDebugLevel

[Description for setDebugLevel]

public setDebugLevel(int $level): void

Parameters

Parameter Type Description
$level int

ƒ getDebugLevel

[Description for getDebugLevel]

public getDebugLevel(): int

ƒ getServiceStatic

Shortcut for the dependency injection.

public static getServiceStatic(string $service): mixed
Parameter Type Description
$service string

ƒ getService

[Description for getService]

public getService(string $service): mixed

Parameters

Parameter Type Description
$service string

ƒ loader

Shortcut for the loader service.

public loader(): \Hubleto\Framework\Loader

ƒ env

Shortcut for the env service.

public env(): \Hubleto\Framework\Env

ƒ authProvider

Shortcut for the authentication service.

public authProvider(): \Hubleto\Framework\Interfaces\AuthProviderInterface

ƒ db

Shortcut for the database service.

public db(): \Hubleto\Framework\Db

ƒ appManager

Shortcut for the app manager service.

public appManager(): \Hubleto\Framework\Interfaces\AppManagerInterface

ƒ router

Shortcut for the router service.

public router(): \Hubleto\Framework\Router

ƒ eventManager

Shortcut for the event manager service.

public eventManager(): \Hubleto\Framework\EventManagerInterface

ƒ sessionManager

Shortcut for the session manager service.

public sessionManager(): \Hubleto\Framework\SessionManager

ƒ permissionsManager

Shortcut for the permissions manager service.

public permissionsManager(): \Hubleto\Framework\PermissionsManager

ƒ cronManager

Shortcut for the cron manager service.

public cronManager(): \Hubleto\Framework\CronManager

ƒ config

Shortcut for the config service.

public config(): \Hubleto\Framework\Interfaces\ConfigManagerInterface

ƒ terminal

Shortcut for the terminal service.

public terminal(): \Hubleto\Framework\Interfaces\TerminalInterface

ƒ logger

Shortcut for the logger service.

public logger(): \Hubleto\Framework\Interfaces\LoggerInterface

ƒ locale

Shortcut for the locale service.

public locale(): \Hubleto\Framework\Interfaces\LocaleInterface

ƒ renderer

Shortcut for the renderer service.

public renderer(): \Hubleto\Framework\Interfaces\RendererInterface

ƒ translator

Shortcut for the translator service.

public translator(): \Hubleto\Framework\Interfaces\TranslatorInterface

ƒ getModel

[Description for getModel]

public getModel(string $model): \Hubleto\Framework\Interfaces\ModelInterface

Parameters

Parameter Type Description
$model string

ƒ getController

[Description for getController]

public getController(string $controller): \Hubleto\Framework\Controller

Parameters

Parameter Type Description
$controller string

ƒ translate

public translate(string $string, array<string,string> $vars = [], string $contextInner = ''): string

Parameters

Parameter Type Description
$string string
$vars array<string,string>
$contextInner string

ƒ initRecordManager

[Description for initRecordManager]

public initRecordManager(): null|object

ƒ isDatabaseConnected

[Description for isDatabaseConnected]

public isDatabaseConnected(): bool

ƒ getConfigFullPath

[Description for getConfigFullPath]

public getConfigFullPath(string $configName): string

Parameters

Parameter Type Description
$configName string

ƒ configAsString

Retrieves value of configuration parameter.

public configAsString(string $configName): void

Parameters

Parameter Type Description
$configName string

ƒ configAsInteger

Retrieves value of configuration parameter.

public configAsInteger(string $configName): void

Parameters

Parameter Type Description
$configName string

ƒ configAsArray

Retrieves value of configuration parameter.

public configAsArray(string $configName): void

Parameters

Parameter Type Description
$configName string

ƒ getSqlEngine

Returns the value of the sqlEngine property, which is used to specify the SQL engine for the model's table.

public getSqlEngine(): array

ƒ getFullTableSqlName

Returns full name of the model's SQL table

public getFullTableSqlName(): string

Return Value

Full name of the model's SQL table

ƒ migrations

Returns list of available migrations looked up from a folder. This method must be overridden by each model and must include at least the default migration of a model.

public migrations(): array

Return Value

List of available migrations

Throws

ƒ getPendingMigrations

Retrieves migrations that are yet to be executed.

public getPendingMigrations(\Hubleto\Framework\Enums\InstalledMigrationEnum $configKey): array

Parameters

Parameter Type Description
$configKey \Hubleto\Framework\Enums\InstalledMigrationEnum

ƒ upgradeSchema

Installs tables of all pending migrations. Internally stores the latest installed migration.

public upgradeSchema(): void

Throws

When an error occurred during the upgrade.

ƒ upgradeForeignKeys

Installs indexes and foreign keys of all pending migrations. Internally stores the latest installed migration.

public upgradeForeignKeys(): void

Throws

When an error occurred during the upgrade.

ƒ hasColumn

[Description for hasColumn]

public hasColumn(string $column): bool

Parameters

Parameter Type Description
$column string

ƒ getColumns

[Description for getColumns]

public getColumns(): array<string,\Hubleto\Framework\Column>

ƒ getColumn

[Description for getColumn]

public getColumn(string $column): \Hubleto\Framework\Interfaces\ColumnInterface

Parameters

Parameter Type Description
$column string

ƒ columnNames

[Description for columnNames]

public columnNames(): array

ƒ indexes

[Description for indexes]

public indexes(array $indexes = []): array

Parameters

Parameter Type Description
$indexes array

ƒ indexNames

[Description for indexNames]

public indexNames(): array

ƒ getPermissions

Gets permissions for the given record.

public getPermissions(array $record): array

Parameters

Parameter Type Description
$record array Record to check permissions for.

ƒ describeColumns

[Description for describeColumns]

public describeColumns(): array

ƒ describeInput

[Description for describeInput]

public describeInput(string $columnName): \Hubleto\Framework\Description\Input

Parameters

Parameter Type Description
$columnName string

ƒ describeForm

[Description for describeForm]

public describeForm(): \Hubleto\Framework\Description\Form

ƒ describeTable

Returns a table description of the model.

public describeTable(): \Hubleto\Framework\Description\Table

The descriptions contains configuration for table UI, columns and permissions.

ƒ describeTree

Returns a tree description of the model.

public describeTree(): \Hubleto\Framework\Description\Tree

The descriptions contains configuration for tree UI.

ƒ convertRecordsToTree

Used to convert flat list of records into tree structure.

public convertRecordsToTree(array $records, int $idParent, int $level): array

Suitable for models having parent-child relationship.

Parameters

Parameter Type Description
$records array
$idParent int
$level int

ƒ diffRecords

[Description for diffRecords]

public diffRecords(array $record1, array $record2): array

Parameters

Parameter Type Description
$record1 array
$record2 array

ƒ getLookupSqlValue

[Description for getLookupSqlValue]

public getLookupSqlValue(string $tableAlias = ''): string

Parameters

Parameter Type Description
$tableAlias string

ƒ getLookupValue

[Description for getLookupValue]

public getLookupValue(array $dataRaw): string

Parameters

Parameter Type Description
$dataRaw array

ƒ getLookupDetails

[Description for getLookupDetailValue]

public getLookupDetails(array $dataRaw): string

Parameters

Parameter Type Description
$dataRaw array

ƒ getRecordDetailUrl

[Description for getRecordDetailUrl]

public getRecordDetailUrl(array $record): string

Parameters

Parameter Type Description
$record array

ƒ getMaxReadLevelForLoadTableData

Returns maxReadLevel value used in loadTableData() method.

public getMaxReadLevelForLoadTableData(): int

By default is set to 0 to save bandwidth when loading data. Override this method in your model if you need to load more details.

ƒ getRelationsIncludedInLoadTableData

Returns list of relations to be included when loading table data.

public getRelationsIncludedInLoadTableData(): array

By default, empty array is returned, which means no relations are included. Override this method in your model if you need to specify particular relations.

ƒ getMaxReadLevelForLoadFormData

Returns maxReadLevel value used in loadFormData() method.

public getMaxReadLevelForLoadFormData(): int

By default is set to 0 to save bandwidth when loading data. Override this method in your model if you need to load more details.

ƒ getRelationsIncludedInLoadFormData

Returns list of relations to be included when loading form data.

public getRelationsIncludedInLoadFormData(): array

By default, empty array is returned, which means no relations are included. Override this method in your model if you need to specify particular relations.

ƒ encryptPassword

Used to encrypt passowrd to store it securely.

public encryptPassword(string $original): string

Parameters

Parameter Type Description
$original string

ƒ onBeforeValidate

onBeforeValidate

public onBeforeValidate(array<string,mixed> $record): array<string,mixed>

Parameters

Parameter Type Description
$record array<string,mixed>

Throws

ƒ onAfterValidate

onBeforeValidate

public onAfterValidate(array<string,mixed> $record): array<string,mixed>

Parameters

Parameter Type Description
$record array<string,mixed>

Throws

ƒ onBeforeCreate

onBeforeCreate

public onBeforeCreate(array<string,mixed> $record): array<string,mixed>

Parameters

Parameter Type Description
$record array<string,mixed>

Throws

ƒ onBeforeUpdate

onBeforeUpdate

public onBeforeUpdate(array<string,mixed> $record): array<string,mixed>

Parameters

Parameter Type Description
$record array<string,mixed>

ƒ onBeforeDelete

onBeforeDelete

public onBeforeDelete(int $id): int

Parameters

Parameter Type Description
$id int

ƒ onAfterCreate

onAfterCreate

public onAfterCreate(array<string,mixed> $savedRecord): array<string,mixed>

Parameters

Parameter Type Description
$savedRecord array<string,mixed>

ƒ onAfterUpdate

onAfterUpdate

public onAfterUpdate(array<string,mixed> $originalRecord, array<string,mixed> $savedRecord): array<string,mixed>

Parameters

Parameter Type Description
$originalRecord array<string,mixed>
$savedRecord array<string,mixed>

ƒ onAfterDelete

onAfterDelete

public onAfterDelete(int $id): int

Parameters

Parameter Type Description
$id int

ƒ onAfterLoadRecord

[Description for onAfterLoadRecord]

public onAfterLoadRecord(array $record): array

Parameters

Parameter Type Description
$record array

ƒ onAfterLoadRecords

[Description for onAfterLoadRecords]

public onAfterLoadRecords(array $records): array

Parameters

Parameter Type Description
$records array