GetAllTrait
Find all entities with filters.
Caching and the NonCacheableFilter gate live at the Api presenter boundary (wire-payload
query cache), not in the service. The service always reads from the database.
Tags
Table of Contents
Methods
- count() : int
- Count all entities matching filters.
-
findAll()
: T>, 1: int} : array{0: list
>, 1: int}) - Find all entities with optional filters and includes.
-
findAllFromDb()
: T>, 1: int} : array{0: list
>, 1: int}) - Load all entities from database via Mapper → Repository.
Methods
count()
Count all entities matching filters.
public
count([array<string|int, mixed> $filters = [] ][, bool $useCache = true ]) : int
Parameters
- $filters : array<string|int, mixed> = []
-
Filter conditions
- $useCache : bool = true
-
kept for backward compatibility; no effect here
Return values
int —Total count
findAll()
Find all entities with optional filters and includes.
public
findAll([array<string|int, mixed> $includes = [] ][, array<string|int, mixed> $filters = [] ][, array<string|int, mixed>|null $orderBy = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, bool $useCache = true ]) : T>, 1: int} : array{0: list>, 1: int})
Parameters
- $includes : array<string|int, mixed> = []
-
Relations to load (e.g., ['translations', 'user.roles'])
- $filters : array<string|int, mixed> = []
-
Filter conditions (e.g., ['activated' => 1])
- $orderBy : array<string|int, mixed>|null = null
-
Sorting (e.g.,
['createdAt' => 'DESC']) - $offset : int|null = null
-
Offset for pagination
- $limit : int|null = null
-
Limit number of results
- $columns : array<string|int, mixed>|null = null
-
Columns to select (null = all)
- $computeTotalCount : bool = false
-
Whether to compute total count for pagination
- $useCache : bool = true
-
kept for backward compatibility (caching is done in the presenter); no effect here
Return values
T>, 1: int} : array{0: listTuple: [entities (or $columns rows), totalCount]
findAllFromDb()
Load all entities from database via Mapper → Repository.
protected
findAllFromDb([array<string|int, mixed> $includes = [] ][, array<string|int, mixed> $filters = [] ][, array<string|int, mixed>|null $orderBy = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ]) : T>, 1: int} : array{0: list>, 1: int})
Parameters
- $includes : array<string|int, mixed> = []
-
Relations to load
- $filters : array<string|int, mixed> = []
-
Filter conditions
- $orderBy : array<string|int, mixed>|null = null
-
Sorting
- $offset : int|null = null
-
Offset
- $limit : int|null = null
-
Limit
- $columns : array<string|int, mixed>|null = null
-
Columns to select
- $computeTotalCount : bool = false
-
Whether to compute total count
Return values
T>, 1: int} : array{0: listTuple: [entities (or $columns rows), totalCount]