TotalModel
extends TotalModel
in package
Class created by Core/Internal/PluginsDeploy
Table of Contents
Properties
- $code : string
- Value of the code field of the model read.
- $totals : array<string|int, mixed>
- Total values of the fields of the read model.
Methods
- __construct() : mixed
- Constructor and class initializer
- all() : array<string|int, static>
- Load a list of TotalModel (code and fields of statistics) for the indicated table.
- clearTotals() : void
- Reset the totals to 0.0
- sum() : float
Properties
$code
Value of the code field of the model read.
public
string
$code
$totals
Total values of the fields of the read model.
public
array<string|int, mixed>
$totals
Methods
__construct()
Constructor and class initializer
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
all()
Load a list of TotalModel (code and fields of statistics) for the indicated table.
public
static all(string $tableName, array<string|int, mixed> $where, array<string|int, mixed> $fieldList[, string $fieldCode = '' ]) : array<string|int, static>
Parameters
- $tableName : string
- $where : array<string|int, mixed>
- $fieldList : array<string|int, mixed>
-
(['key' => 'SUM(total)', 'key2' => 'MAX(total)' ...])
- $fieldCode : string = ''
-
(for multiples rows grouped by field code)
Return values
array<string|int, static>clearTotals()
Reset the totals to 0.0
public
clearTotals(array<string|int, mixed> $totalFields) : void
Parameters
- $totalFields : array<string|int, mixed>
sum()
public
static sum(string $tableName, string $fieldName, array<string|int, mixed> $where) : float
Parameters
- $tableName : string
- $fieldName : string
- $where : array<string|int, mixed>