GroupedSelection
class GroupedSelection extends Selection
Represents filtered table grouped by referencing table.
GroupedSelection is based on the great library NotORM http://www.notorm.com written by Jakub Vrana.
Properties
| protected | $refCacheCurrent | current assigned referencing array |
|
| protected | $active | primary key |
Methods
Creates filtered and grouped table representation.
Sets active group.
Adds a SELECT clause. Automatically prepends the grouping column if no select exists yet.
Adds an ORDER BY clause. Automatically prepends the grouping column (matching direction) to improve index utilization.
Invalidates cached data and forces reload on next access.
Calculates aggregation for this group.
Returns count of fetched rows, or runs COUNT($column) query when column is specified.
No description
No description
Initializes the reference cache for the current selection. Overridden by GroupedSelection.
No description
No description
Updates all rows matching current conditions. JOINs in UPDATE are supported only by MySQL.
Deletes all rows matching current conditions.
Details
at line 35
__construct(Explorer $explorer, Conventions $conventions, string $tableName, string $column, Selection $refTable, Storage|null $cacheStorage = null)
Creates filtered and grouped table representation.
at line 54
GroupedSelection
setActive(int|string $active)
| internal |
Sets active group.
at line 64
Selection
select(string $columns, mixed ...$params)
Adds a SELECT clause. Automatically prepends the grouping column if no select exists yet.
at line 77
Selection
order(string $columns, mixed ...$params)
Adds an ORDER BY clause. Automatically prepends the grouping column (matching direction) to improve index utilization.
at line 91
void
refreshData()
Invalidates cached data and forces reload on next access.
at line 104
mixed
aggregation(string $function, string|null $groupFunction = null)
Calculates aggregation for this group.
at line 143
int
count(string|null $column = null)
Returns count of fetched rows, or runs COUNT($column) query when column is specified.
at line 152
protected void
execute()
No description
at line 218
protected Selection
getRefTable(mixed $refPath)
No description
at line 231
protected void
loadRefCache()
Initializes the reference cache for the current selection. Overridden by GroupedSelection.
at line 246
protected void
emptyResultSet(bool $clearCache = true, bool $deleteReferencedCache = true)
No description
at line 258
ActiveRow|array|int
insert(iterable $data)
No description
at line 277
int
update(iterable $data)
Updates all rows matching current conditions. JOINs in UPDATE are supported only by MySQL.
at line 290
int
delete()
Deletes all rows matching current conditions.