Default implementation of model for Hubleto project.
\Hubleto\Framework\Models\UserHasRole
| Parent class | \Hubleto\Framework\Model |
Properties
☍ table
public string $table
☍ recordManagerClass
public string $recordManagerClass
☍ isJunctionTable
public bool $isJunctionTable
If set to TRUE, the SQL table will not contain the ID autoincrement column
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
- This method is static.
Parameters
| Parameter | Type | Description |
|---|---|---|
$service |
string |
ƒ getService
[Description for getService]
public getService(string $service): mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$service |
string |
ƒ env
Shortcut for the env service.
public env(): \Hubleto\Framework\Env
ƒ authProvider
Shortcut for the authentication service.
public authProvider(): \Hubleto\Framework\Interfaces\AuthInterface
ƒ 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
ƒ hookManager
Shortcut for the hook manager service.
public hookManager(): \Hubleto\Framework\HookManager
ƒ 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
ƒ emailProvider
Shortcut for the email provider service.
public emailProvider(): \Hubleto\Framework\EmailProvider
ƒ 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 |
ƒ getSqlCreateTableCommands
[Description for getSqlCreateTableCommands]
public getSqlCreateTableCommands(): array
ƒ createSqlTable
[Description for createSqlTable]
public createSqlTable(): mixed
ƒ install
Installs the first version of the model into SQL database. Automatically creates indexes.
public install(): void
ƒ dropTableIfExists
[Description for dropTableIfExists]
public dropTableIfExists(): \Hubleto\Framework\Model
ƒ createSqlForeignKeys
Create foreign keys for the SQL table. Called when all models are installed.
public createSqlForeignKeys(): void
ƒ getFullTableSqlName
Returns full name of the model's SQL table
public getFullTableSqlName(): string
Return Value
Full name of the model's SQL table
ƒ upgrades
Returns list of available upgrades. This method must be overriden by each model.
public upgrades(): array
Return Value
List of available upgrades. Keys of the array are simple numbers starting from 1.
ƒ getAvailableUpgrades
[Description for hasAvailableUpgrades]
public getAvailableUpgrades(): array
ƒ installUpgrades
Installs all upgrades of the model. Internaly stores current version and compares it to list of available upgrades.
public installUpgrades(): void
Throws
When an error occured 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
ƒ 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.
ƒ 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 |
ƒ loadTableData
Loads records to be displayed in table.
public loadTableData(string $fulltextSearch = '', array $columnSearch = [], array $orderBy = [], int $itemsPerPage = 15, int $page, string $dataView = ''): array
Parameters
| Parameter | Type | Description |
|---|---|---|
$fulltextSearch |
string | |
$columnSearch |
array | |
$orderBy |
array | |
$itemsPerPage |
int | |
$page |
int | |
$dataView |
string |
ƒ diffRecords
[Description for diffRecords]
public diffRecords(array $record1, array $record2): array
Parameters
| Parameter | Type | Description |
|---|---|---|
$record1 |
array | |
$record2 |
array |
ƒ getById
[Description for getById]
public getById(int $id): mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$id |
int |
ƒ 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 |
ƒ getItemDetailUrl
[Description for getItemDetailUrl]
public getItemDetailUrl(int $id): string
Parameters
| Parameter | Type | Description |
|---|---|---|
$id |
int |
ƒ 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.
ƒ encryptPassword
Used to encrypt passowrd to store it securely.
public encryptPassword(string $original): string
Parameters
| Parameter | Type | Description |
|---|---|---|
$original |
string |
ƒ 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 |
