JoinHelper
in package
Resolves field paths to join aliases and adds the missing left joins to a query builder.
Aliases are cached per QueryBuilder (WeakMap), not globally for the last used builder.
Alternating between independent builders over the same entity (the main query,
TotalCountTrait::computeTotalCount(), GroupFilter::apply() which clones the builder for
every sub-filter) must not mix their aliases; a cache entry disappears with its builder.
Table of Contents
Properties
- $aliasCaches : WeakMap<QueryBuilder, array<string, string>>
Methods
- resolveColumn() : string
- Resolves the alias of a column and adds the joins needed to reach it.
- caches() : WeakMap<QueryBuilder, array<string, string>>
- Returns the `WeakMap` with all per-builder alias caches (created lazily).
- registerExistingJoins() : void
- Registers the aliases of joins that already exist on `$qb`, so `resolveColumn()` does not add the same join twice.
Properties
$aliasCaches
private
static WeakMap<QueryBuilder, array<string, string>>
$aliasCaches
Methods
resolveColumn()
Resolves the alias of a column and adds the joins needed to reach it.
public
static resolveColumn(QueryBuilder $qb, string $field[, string|null $fromTableAlias = null ][, string|null $textTableAlias = null ]) : string
Parameters
- $qb : QueryBuilder
- $field : string
- $fromTableAlias : string|null = null
- $textTableAlias : string|null = null
Return values
stringcaches()
Returns the `WeakMap` with all per-builder alias caches (created lazily).
private
static caches() : WeakMap<QueryBuilder, array<string, string>>
Return values
WeakMap<QueryBuilder, array<string, string>>registerExistingJoins()
Registers the aliases of joins that already exist on `$qb`, so `resolveColumn()` does not add the same join twice.
private
static registerExistingJoins(QueryBuilder $qb, array<string, string> &$cache) : void
Parameters
- $qb : QueryBuilder
- $cache : array<string, string>
-
may be empty (new or untouched builder).