MagratheaModelControl
in package
Table of Contents
Properties
- $dbTable : mixed
- $modelName : mixed
- $modelNamespace : mixed
Methods
- __toString() : string
- GetAll() : array<string|int, object>
- Gets all from this object
- 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
- 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
- GetWhere() : array<string|int, object>
- Builds query with where clause
- 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
- ShowAll() : mixed
- Show all elements from an object
Properties
$dbTable
protected
static mixed
$dbTable
$modelName
protected
static mixed
$modelName
$modelNamespace
protected
static mixed
$modelNamespace
Methods
__toString()
public
__toString() : string
Return values
stringGetAll()
Gets all from this object
public
static GetAll() : array<string|int, object>
Return values
array<string|int, object> —List of objects
GetListPage()
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
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
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
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
ShowAll()
Show all elements from an object
public
static ShowAll() : mixed