v0

Default implementation of model for Hubleto project.

\Hubleto\Framework\Model

Parent class\Hubleto\Framework\Core
Implements \Hubleto\Framework\Interfaces\ModelInterface

Constants

Constant Visibility Type Value
HAS_ONE public 'hasOne'
HAS_MANY public 'hasMany'
BELONGS_TO public 'belongsTo'

Properties

fullName

Full name of the model. Useful for getModel() function

public string $fullName

shortName

Short name of the model. Useful for debugging purposes

public string $shortName

record

public \Illuminate\Database\Eloquent\Model|\Hubleto\Framework\Interfaces\RecordManagerInterface $record

lookupSqlValue

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

public ?string $lookupSqlValue

lookupUrlDetail

public ?string $lookupUrlDetail

lookupUrlAdd

public ?string $lookupUrlAdd

isJunctionTable

If set to TRUE, the SQL table will not contain the ID autoincrement column

public bool $isJunctionTable

sqlEngine

public string $sqlEngine

table

public string $table

recordManagerClass

public string $recordManagerClass

relations

public array $relations

junctions

public ?array $junctions

columns

protected array $columns

isExtendableByCustomColumns

public bool $isExtendableByCustomColumns

conversionRelations

public array $conversionRelations

permission

public string $permission

rolePermissions

public array $rolePermissions

Methods

__construct

public __construct(): mixed

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.

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

[Description for describeTable]

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

recordGet

[Description for recordGet]

public recordGet(callable|null $queryModifierCallback = null): array

Parameters:

Parameter Type Description
$queryModifierCallback callable|null

recordGetList

[Description for recordGetList]

public recordGetList(string $fulltextSearch = '', array $columnSearch = [], array $orderBy = [], int $itemsPerPage = 15, int $page): array

Parameters:

Parameter Type Description
$fulltextSearch string
$columnSearch array
$orderBy array
$itemsPerPage int
$page int

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

encryptPassword

Used to encrypt passowrd to store it securely.

public encryptPassword(string $original): string

Parameters:

Parameter Type Description
$original string

onBeforeCreate

[Description for onBeforeCreate]

public onBeforeCreate(array $record): array

Parameters:

Parameter Type Description
$record array

onBeforeUpdate

[Description for onBeforeUpdate]

public onBeforeUpdate(array $record): array

Parameters:

Parameter Type Description
$record array

onAfterCreate

[Description for onAfterCreate]

public onAfterCreate(array $savedRecord): array

Parameters:

Parameter Type Description
$savedRecord array

onAfterUpdate

[Description for onAfterUpdate]

public onAfterUpdate(array $originalRecord, array $savedRecord): array

Parameters:

Parameter Type Description
$originalRecord array
$savedRecord array

onBeforeDelete

[Description for onBeforeDelete]

public onBeforeDelete(int $id): int

Parameters:

Parameter Type Description
$id int

onAfterDelete

[Description for 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

Inherited methods

__construct

public __construct(): mixed

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

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

logger

Shortcut for the logger service.

public logger(): \Hubleto\Framework\Logger

locale

Shortcut for the locale service.

public locale(): \Hubleto\Framework\Locale

renderer

Shortcut for the renderer service.

public renderer(): \Hubleto\Framework\Renderer

translator

Shortcut for the translator service.

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

getModel

[Description for getModel]

public getModel(string $model): \Hubleto\Framework\Models\Model

Parameters:

Parameter Type Description
$model string

getController

[Description for getController]

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

Parameters:

Parameter Type Description
$controller string

translate

Shorthand for core translate() function. Uses own language dictionary.

public translate(string $string, array $vars = []): string

Parameters:

Parameter Type Description
$string string String to be translated
$vars array

Return Value:

Translated string.

www.hubleto.com | Found a bug or missing something? Report an issue via GitHub.