AppConfigControl
extends MagratheaModelControl
in package
Class for installing Magrathea's Admin
Table of Contents
Properties
- $dbTable : mixed
- $modelName : mixed
- $modelNamespace : mixed
Methods
- __toString() : string
- ExportData() : string
- Exports data
- GetAll() : array<string|int, object>
- Gets all from this object
- GetByKey() : AppConfig
- Gets an AppConfig by key
- GetListPage() : array<string|int, object>
- Gets all from this object
- GetModelName() : mixed
- GetMultipleObjects() : array<string|int, object>
- This function allows to build a query getting multiple objects at once
- GetOnlyApp() : array<string|int, mixed>
- hides system config
- GetRowWhere() : object|array<string|int, mixed>
- Builds query with where clause, returning only first row
- GetSelectArray() : array<string|int, object>
- Gets all from this object
- GetSimpleWhere() : array<string|int, object>
- Builds query with where clause
- GetValue() : mixed
- returns a value for a key
- GetValueByKey() : string|null
- Gets the value of an AppConfig
- GetWhere() : array<string|int, object>
- Builds query with where clause
- ImportData() : bool
- Imports data
- ParseLine() : array<string|int, mixed>
- parses line
- QueryOne() : object
- Runs a query and returns the first result
- QueryResult() : array<string|int, mixed>
- Runs a query and returns the result
- QueryRow() : array<string|int, mixed>
- Runs a query and returns the first row of result
- Run() : array<string|int, object>
- Runs a Magrathea Query and returns a list of objects
- RunMagQuery() : array<string|int, object>
- Runs a Magrathea Query and returns a list of objects (calls Run function)
- RunPagination() : array<string|int, object>
- Runs query with Pagination.
- RunQuery() : array<string|int, object>
- Run a query and return a list of the objects
- RunRow() : object
- Run a query and return the first object available
- Save() : AppConfig
- sets the value for a key
- SaveSystem() : AppConfig
- saves a system key (for Magrathea's internal use)
- SetValue() : mixed
- sets the value for a key
- ShowAll() : mixed
- Show all elements from an object
Properties
$dbTable
protected
static mixed
$dbTable
= "_magrathea_config"
$modelName
protected
static mixed
$modelName
= "Magrathea2\\Admin\\Features\\AppConfig\\AppConfig"
$modelNamespace
protected
static mixed
$modelNamespace
Methods
__toString()
public
__toString() : string
Return values
stringExportData()
Exports data
public
ExportData([bool $hideSystem = false ]) : string
Parameters
- $hideSystem : bool = false
Return values
stringGetAll()
Gets all from this object
public
static GetAll() : array<string|int, object>
Return values
array<string|int, object> —List of objects
GetByKey()
Gets an AppConfig by key
public
GetByKey(string $key) : AppConfig
Parameters
- $key : string
-
key
Return values
AppConfigGetListPage()
Gets all from this object
public
static GetListPage([int $limit = 20 ][, int $page = 0 ]) : array<string|int, object>
Parameters
- $limit : int = 20
- $page : int = 0
Return values
array<string|int, object> —List of objects
GetModelName()
public
static GetModelName() : mixed
GetMultipleObjects()
This function allows to build a query getting multiple objects at once
public
static GetMultipleObjects(array<string|int, object> $array_objects, string $joinGlue[, string $where = "" ]) : array<string|int, object>
Parameters
- $array_objects : array<string|int, object>
-
Array of objects
- $joinGlue : string
-
join string to be used on query
- $where : string = ""
-
Where clause
Return values
array<string|int, object> —List of objects
GetOnlyApp()
hides system config
public
GetOnlyApp() : array<string|int, mixed>
Return values
array<string|int, mixed> —array of AdminConfig
GetRowWhere()
Builds query with where clause, returning only first row
public
static GetRowWhere(string|array<string|int, mixed> $arr[, string $condition = "AND" ]) : object|array<string|int, mixed>
Parameters
- $arr : string|array<string|int, mixed>
-
where clause
- $condition : string = "AND"
-
"AND" or "OR" for multiple clauses
Return values
object|array<string|int, mixed> —First object available
GetSelectArray()
Gets all from this object
public
static GetSelectArray() : array<string|int, object>
Return values
array<string|int, object> —List of objects
GetSimpleWhere()
Builds query with where clause
public
static GetSimpleWhere(string $whereSql) : array<string|int, object>
Parameters
- $whereSql : string
-
where clause
Return values
array<string|int, object> —List of objects
GetValue()
returns a value for a key
public
GetValue(string $key) : mixed
Parameters
- $key : string
-
key to get
GetValueByKey()
Gets the value of an AppConfig
public
GetValueByKey(string $key[, string $default = null ]) : string|null
Parameters
- $key : string
- $default : string = null
-
if key is not found, this will be the default value
Return values
string|null —returns the value, the default or null if no key is found and no default is set
GetWhere()
Builds query with where clause
public
static GetWhere(string|array<string|int, mixed> $arr[, string $condition = "AND" ]) : array<string|int, object>
Parameters
- $arr : string|array<string|int, mixed>
-
where clause
- $condition : string = "AND"
-
"AND" or "OR" for multiple clauses
Return values
array<string|int, object> —List of objects
ImportData()
Imports data
public
ImportData(string $dataStr[, bool $echoProgress = false ]) : bool
Parameters
- $dataStr : string
- $echoProgress : bool = false
Return values
boolParseLine()
parses line
public
ParseLine(string $line) : array<string|int, mixed>
Parameters
- $line : string
-
line
Return values
array<string|int, mixed> —[key, system, value]
QueryOne()
Runs a query and returns the first result
public
static QueryOne(string $sql) : object
Parameters
- $sql : string
-
query string
Return values
object —database result (first item)
QueryResult()
Runs a query and returns the result
public
static QueryResult(string $sql) : array<string|int, mixed>
Parameters
- $sql : string
-
query string
Return values
array<string|int, mixed> —database result
QueryRow()
Runs a query and returns the first row of result
public
static QueryRow(string $sql) : array<string|int, mixed>
Parameters
- $sql : string
-
query string
Return values
array<string|int, mixed> —database result (first line)
Run()
Runs a Magrathea Query and returns a list of objects
public
static Run(Query $magQuery[, bool $onlyFirst = false ]) : array<string|int, object>
Parameters
- $magQuery : Query
-
MagratheaQuery query
- $onlyFirst : bool = false
-
returns all of it or only first row?
Return values
array<string|int, object> —List of objects
RunMagQuery()
Runs a Magrathea Query and returns a list of objects (calls Run function)
public
static RunMagQuery(Query $magQuery) : array<string|int, object>
Parameters
- $magQuery : Query
-
MagratheaQuery query
Return values
array<string|int, object> —List of objects
RunPagination()
Runs query with Pagination.
public
static RunPagination(Query $magQuery, int &$total[, int $page = 0 ][, int $limit = 20 ]) : array<string|int, object>
This way, is not necessary to worry about including pagination on Magrathea Query, this function can deal with it
Parameters
- $magQuery : Query
-
MagratheaQuery query
- $total : int
-
total of rows (it will be stored in this variable; it's a pointer!)
- $page : int = 0
-
page to get (0 = first)
- $limit : int = 20
-
quantity per page (20 = default)
Return values
array<string|int, object> —List of objects
RunQuery()
Run a query and return a list of the objects
public
static RunQuery(string $sql) : array<string|int, object>
Parameters
- $sql : string
-
query string
Return values
array<string|int, object> —List of objects
RunRow()
Run a query and return the first object available
public
static RunRow(string $sql) : object
Parameters
- $sql : string
-
query string
Return values
object —First object found
Save()
sets the value for a key
public
Save(string $key, string|any $value[, bool $overwrite = true ][, bool $system = false ]) : AppConfig
Parameters
- $key : string
- $value : string|any
- $overwrite : bool = true
-
should overwrite value
- $system : bool = false
-
is this a system var?
Return values
AppConfigSaveSystem()
saves a system key (for Magrathea's internal use)
public
SaveSystem(string $key, string|any $value[, mixed $overwrite = true ]) : AppConfig
Parameters
- $key : string
- $value : string|any
- $overwrite : mixed = true
Return values
AppConfigSetValue()
sets the value for a key
public
SetValue(string $key, string $value) : mixed
Parameters
- $key : string
- $value : string
ShowAll()
Show all elements from an object
public
static ShowAll() : mixed