Model
extends Model
in package
Core implementation of database model. Extends from Eloquent's model and adds own functionalities.
Table of Contents
- $adios : mixed
- Reference to ADIOS object
- $eloquentQuery : mixed
- $formTitleForEditing : mixed
- Readable title for the form when editing content.
- $formTitleForInserting : mixed
- Readable title for the form when inserting content.
- $gtp : mixed
- Shorthand for "global table prefix"
- $languageDictionary : array<string|int, mixed>
- Language dictionary for the context of the model
- $lookupSqlValue : mixed
- SQL-compatible string used to render displayed value of the record when used as a lookup.
- $name : mixed
- Full name of the model. Useful for getModel() function
- $pdo : mixed
- $searchAction : mixed
- $shortName : mixed
- Short name of the model. Useful for debugging purposes
- $sqlName : mixed
- Name of the table in SQL database. Used together with global table prefix.
- $tableTitle : mixed
- Readable title for the table listing.
- $timestamps : bool
- ADIOS model does not use time stamps
- $urlBase : mixed
- URL base for management of the content of the table. If not empty, ADIOS automatically creates URL addresses for listing the content, adding and editing the content.
- $guarded : mixed
- $primaryKey : string
- ADIOS model's primary key is always 'id'
- __construct() : void
- Creates instance of model's object.
- addCrossTableToQuery() : mixed
- addLookupsToQuery() : mixed
- addStandardCRUDRouting() : mixed
- associateKey() : mixed
- cardsCardHtmlFormatter() : mixed
- cardsParams() : mixed
- columnNames() : mixed
- columns() : mixed
- deleteRow() : mixed
- extractLookupFromQueryResult() : mixed
- fetchQueryAsArray() : mixed
- findForeignKeyModels() : mixed
- formParams() : mixed
- formSave() : mixed
- formValidate() : mixed
- getAll() : mixed
- getById() : mixed
- getConfig() : void
- Retrieves value of configuration parameter.
- getCurrentInstalledVersion() : void
- Gets the current installed version of the model. Used during installing upgrades.
- getEnumValues() : mixed
- getExtendedData() : mixed
- getFullTableSQLName() : string
- Returns full name of the model's SQL table
- getFullUrlBase() : void
- Returns full relative URL path for model. Used when generating URL paths for tables, forms, etc.
- getQuery() : mixed
- getQueryWithLookups() : mixed
- getWithLookups() : mixed
- hasAvailableUpgrades() : bool
- indexes() : mixed
- indexNames() : mixed
- init() : void
- Empty placeholder for callback called after the instance has been created in constructor.
- insertRandomRow() : mixed
- insertRow() : mixed
- install() : void
- Installs the first version of the model into SQL database. Automaticaly creates indexes.
- installForeignKeys() : void
- Create foreign keys for the SQL table. Called when all models are installed.
- installUpgrades() : void
- Installs all upgrades of the model. Internaly stores current version and compares it to list of available upgrades.
- isInstalled() : bool
- Checks whether model is installed.
- lookupSqlOrderBy() : mixed
- lookupSqlQuery() : mixed
- lookupSqlValue() : mixed
- lookupSqlWhere() : mixed
- onAfterDelete() : mixed
- onAfterSave() : mixed
- onBeforeDelete() : mixed
- onBeforeSave() : mixed
- onTableAfterDataLoaded() : mixed
- pdoPrepareAndExecute() : mixed
- pdoPrepareExecuteAndFetch() : mixed
- processLookupsInQueryResult() : mixed
- routing() : mixed
- saveConfig() : void
- Persistantly saves the value of configuration parameter to the database.
- search() : mixed
- setConfig() : void
- Sets the value of configuration parameter.
- sqlQuery() : mixed
- tableCellCSSFormatter() : mixed
- tableCellCSVExportFormatter() : mixed
- tableCellHTMLFormatter() : mixed
- tableFilterColumnSqlWhere() : mixed
- tableFilterSqlWhere() : mixed
- tableParams() : mixed
- tableRowCSSFormatter() : mixed
- translate() : string
- Shorthand for ADIOS core translate() function. Uses own language dictionary.
- treeParams() : mixed
- updateRow() : mixed
- upgrades() : array<string|int, mixed>
- Returns list of available upgrades. This method must be overriden by each model.
Properties
$adios
Reference to ADIOS object
public
mixed
$adios
$eloquentQuery
public
mixed
$eloquentQuery
$formTitleForEditing
Readable title for the form when editing content.
public
mixed
$formTitleForEditing
= ""
$formTitleForInserting
Readable title for the form when inserting content.
public
mixed
$formTitleForInserting
= ""
$gtp
Shorthand for "global table prefix"
public
mixed
$gtp
= ""
$languageDictionary
Language dictionary for the context of the model
public
array<string|int, mixed>
$languageDictionary
= []
$lookupSqlValue
SQL-compatible string used to render displayed value of the record when used as a lookup.
public
mixed
$lookupSqlValue
= ""
$name
Full name of the model. Useful for getModel() function
public
mixed
$name
= ""
$pdo
public
mixed
$pdo
$searchAction
public
mixed
$searchAction
$shortName
Short name of the model. Useful for debugging purposes
public
mixed
$shortName
= ""
$sqlName
Name of the table in SQL database. Used together with global table prefix.
public
mixed
$sqlName
= ""
$tableTitle
Readable title for the table listing.
public
mixed
$tableTitle
= ""
$timestamps
ADIOS model does not use time stamps
public
bool
$timestamps
= false
$urlBase
URL base for management of the content of the table. If not empty, ADIOS automatically creates URL addresses for listing the content, adding and editing the content.
public
mixed
$urlBase
= ""
$guarded
protected
mixed
$guarded
= []
$primaryKey
ADIOS model's primary key is always 'id'
protected
string
$primaryKey
= 'id'
Methods
__construct()
Creates instance of model's object.
public
__construct([mixed $adiosOrAttributes = NULL ][, mixed $eloquentQuery = NULL ]) : void
Parameters
- $adiosOrAttributes : mixed = NULL
- $eloquentQuery : mixed = NULL
Return values
void —addCrossTableToQuery()
public
addCrossTableToQuery(mixed $query, mixed $crossTableModelName[, mixed $resultKey = '' ]) : mixed
Parameters
- $query : mixed
- $crossTableModelName : mixed
- $resultKey : mixed = ''
Return values
mixed —addLookupsToQuery()
public
addLookupsToQuery(mixed $query[, mixed $lookupsToAdd = NULL ]) : mixed
Parameters
- $query : mixed
- $lookupsToAdd : mixed = NULL
Return values
mixed —addStandardCRUDRouting()
public
addStandardCRUDRouting([mixed $routing = [] ]) : mixed
Parameters
- $routing : mixed = []
Return values
mixed —associateKey()
public
associateKey(mixed $input, mixed $key) : mixed
Parameters
- $input : mixed
- $key : mixed
Return values
mixed —cardsCardHtmlFormatter()
public
cardsCardHtmlFormatter(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —cardsParams()
public
cardsParams(mixed $params) : mixed
Parameters
- $params : mixed
Return values
mixed —columnNames()
public
columnNames() : mixed
Return values
mixed —columns()
public
columns([array<string|int, mixed> $columns = [] ]) : mixed
Parameters
- $columns : array<string|int, mixed> = []
Return values
mixed —deleteRow()
public
deleteRow(mixed $id) : mixed
Parameters
- $id : mixed
Return values
mixed —extractLookupFromQueryResult()
public
extractLookupFromQueryResult(mixed $rows, mixed $lookup) : mixed
Parameters
- $rows : mixed
- $lookup : mixed
Return values
mixed —fetchQueryAsArray()
public
fetchQueryAsArray(mixed $eloquentQuery[, mixed $keyBy = 'id' ][, mixed $processOutput = TRUE ]) : mixed
Parameters
- $eloquentQuery : mixed
- $keyBy : mixed = 'id'
- $processOutput : mixed = TRUE
Return values
mixed —findForeignKeyModels()
public
findForeignKeyModels() : mixed
Return values
mixed —formParams()
public
formParams(mixed $data, mixed $params) : mixed
Parameters
- $data : mixed
- $params : mixed
Return values
mixed —formSave()
public
formSave(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —formValidate()
public
formValidate(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —getAll()
public
getAll([string $keyBy = "id" ]) : mixed
Parameters
- $keyBy : string = "id"
Return values
mixed —getById()
public
getById(int $id) : mixed
Parameters
- $id : int
Return values
mixed —getConfig()
Retrieves value of configuration parameter.
public
getConfig(string $configName) : void
Parameters
- $configName : string
Return values
void —getCurrentInstalledVersion()
Gets the current installed version of the model. Used during installing upgrades.
public
getCurrentInstalledVersion() : void
Return values
void —getEnumValues()
public
getEnumValues() : mixed
Return values
mixed —getExtendedData()
public
getExtendedData(mixed $item) : mixed
Parameters
- $item : mixed
Return values
mixed —getFullTableSQLName()
Returns full name of the model's SQL table
public
getFullTableSQLName() : string
Return values
string —Full name of the model's SQL table
getFullUrlBase()
Returns full relative URL path for model. Used when generating URL paths for tables, forms, etc.
public
getFullUrlBase(mixed $params) : void
..
Parameters
- $params : mixed
Return values
void —getQuery()
public
getQuery([mixed $columns = NULL ]) : mixed
Parameters
- $columns : mixed = NULL
Return values
mixed —getQueryWithLookups()
public
getQueryWithLookups([mixed $callback = NULL ]) : mixed
Parameters
- $callback : mixed = NULL
Return values
mixed —getWithLookups()
public
getWithLookups([mixed $callback = NULL ][, mixed $keyBy = 'id' ]) : mixed
Parameters
- $callback : mixed = NULL
- $keyBy : mixed = 'id'
Return values
mixed —hasAvailableUpgrades()
public
hasAvailableUpgrades() : bool
Return values
bool —indexes()
public
indexes([array<string|int, mixed> $indexes = [] ]) : mixed
Parameters
- $indexes : array<string|int, mixed> = []
Return values
mixed —indexNames()
public
indexNames() : mixed
Return values
mixed —init()
Empty placeholder for callback called after the instance has been created in constructor.
public
init() : void
Return values
void —insertRandomRow()
public
insertRandomRow([mixed $data = [] ][, mixed $dictionary = [] ]) : mixed
Parameters
- $data : mixed = []
- $dictionary : mixed = []
Return values
mixed —insertRow()
public
insertRow(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —install()
Installs the first version of the model into SQL database. Automaticaly creates indexes.
public
install() : void
Return values
void —installForeignKeys()
Create foreign keys for the SQL table. Called when all models are installed.
public
installForeignKeys() : void
Return values
void —installUpgrades()
Installs all upgrades of the model. Internaly stores current version and compares it to list of available upgrades.
public
installUpgrades() : void
Return values
void —isInstalled()
Checks whether model is installed.
public
isInstalled() : bool
Return values
bool —TRUE if model is installed, otherwise FALSE.
lookupSqlOrderBy()
public
lookupSqlOrderBy([mixed $initiatingModel = NULL ][, mixed $initiatingColumn = NULL ][, mixed $formData = [] ][, mixed $params = [] ]) : mixed
Parameters
- $initiatingModel : mixed = NULL
- $initiatingColumn : mixed = NULL
- $formData : mixed = []
- $params : mixed = []
Return values
mixed —lookupSqlQuery()
public
lookupSqlQuery([mixed $initiatingModel = NULL ][, mixed $initiatingColumn = NULL ][, mixed $formData = [] ][, mixed $params = [] ][, mixed $having = "TRUE" ]) : mixed
Parameters
- $initiatingModel : mixed = NULL
- $initiatingColumn : mixed = NULL
- $formData : mixed = []
- $params : mixed = []
- $having : mixed = "TRUE"
Return values
mixed —lookupSqlValue()
public
lookupSqlValue([mixed $tableAlias = NULL ]) : mixed
Parameters
- $tableAlias : mixed = NULL
Return values
mixed —lookupSqlWhere()
public
lookupSqlWhere([mixed $initiatingModel = NULL ][, mixed $initiatingColumn = NULL ][, mixed $formData = [] ][, mixed $params = [] ]) : mixed
Parameters
- $initiatingModel : mixed = NULL
- $initiatingColumn : mixed = NULL
- $formData : mixed = []
- $params : mixed = []
Return values
mixed —onAfterDelete()
public
onAfterDelete(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —onAfterSave()
public
onAfterSave(mixed $data, mixed $returnValue) : mixed
Parameters
- $data : mixed
- $returnValue : mixed
Return values
mixed —onBeforeDelete()
public
onBeforeDelete(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —onBeforeSave()
public
onBeforeSave(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —onTableAfterDataLoaded()
public
onTableAfterDataLoaded(mixed $tableObject) : mixed
Parameters
- $tableObject : mixed
Return values
mixed —pdoPrepareAndExecute()
public
pdoPrepareAndExecute(string $query, array<string|int, mixed> $variables) : mixed
Parameters
- $query : string
- $variables : array<string|int, mixed>
Return values
mixed —pdoPrepareExecuteAndFetch()
public
pdoPrepareExecuteAndFetch(string $query, array<string|int, mixed> $variables) : mixed
Parameters
- $query : string
- $variables : array<string|int, mixed>
Return values
mixed —processLookupsInQueryResult()
public
processLookupsInQueryResult(mixed $rows) : mixed
Parameters
- $rows : mixed
Return values
mixed —routing()
public
routing([array<string|int, mixed> $routing = [] ]) : mixed
Parameters
- $routing : array<string|int, mixed> = []
Return values
mixed —saveConfig()
Persistantly saves the value of configuration parameter to the database.
public
saveConfig(string $configName, mixed $value) : void
Parameters
- $configName : string
- $value : mixed
Return values
void —search()
public
search(mixed $q) : mixed
Parameters
- $q : mixed
Return values
mixed —setConfig()
Sets the value of configuration parameter.
public
setConfig(string $configName, mixed $value) : void
Parameters
- $configName : string
- $value : mixed
Return values
void —sqlQuery()
public
sqlQuery(mixed $query) : mixed
Parameters
- $query : mixed
Return values
mixed —tableCellCSSFormatter()
public
tableCellCSSFormatter(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —tableCellCSVExportFormatter()
public
tableCellCSVExportFormatter(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —tableCellHTMLFormatter()
public
tableCellHTMLFormatter(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —tableFilterColumnSqlWhere()
public
tableFilterColumnSqlWhere(mixed $columnName, mixed $filterValue[, mixed $column = NULL ]) : mixed
Parameters
- $columnName : mixed
- $filterValue : mixed
- $column : mixed = NULL
Return values
mixed —tableFilterSqlWhere()
public
tableFilterSqlWhere(mixed $filterValues) : mixed
Parameters
- $filterValues : mixed
Return values
mixed —tableParams()
public
tableParams(mixed $params) : mixed
Parameters
- $params : mixed
Return values
mixed —tableRowCSSFormatter()
public
tableRowCSSFormatter(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —translate()
Shorthand for ADIOS core translate() function. Uses own language dictionary.
public
translate(string $string[, string $context = "" ][, string $toLanguage = "" ]) : string
Parameters
- $string : string
-
String to be translated
- $context : string = ""
-
Context where the string is used
- $toLanguage : string = ""
-
Output language
Return values
string —Translated string.
treeParams()
public
treeParams(mixed $params) : mixed
Parameters
- $params : mixed
Return values
mixed —updateRow()
public
updateRow(mixed $data, mixed $id) : mixed
Parameters
- $data : mixed
- $id : mixed
Return values
mixed —upgrades()
Returns list of available upgrades. This method must be overriden by each model.
public
upgrades() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of available upgrades. Keys of the array are simple numbers starting from 1.