BaseCollection
in package
implements
ArrayAccess, IteratorAggregate
A LessQL Collection
Table of Contents
Interfaces
- ArrayAccess
- IteratorAggregate
Constants
- ITEMS_PER_PAGE = 50
Properties
- $className : string
- $items : array<string|int, mixed>
- $stmt : Result|null
Methods
- __construct() : mixed
- addCondition() : static
- adds condition to collection
- addGroupBy() : static
- addHaving() : static
- addOrder() : static
- adds order to collection
- addSelect() : static
- count() : int
- delete() : static
- fetchAllDbRows() : mixed
- fetchDbRow() : mixed
- getFirst() : mixed
- getItems() : array<string|int, mixed>
- gets collection items
- getIterator() : Traversable|ArrayIterator
- getSelect() : Result
- get collection select object
- getTableName() : string
- gets collection objects table name
- limit() : static
- limit results
- load() : static
- loads collection items
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- paginate() : array<string|int, mixed>
- return subset of found items (useful for paginate)
- persist() : static
- persists collection items
- remove() : static
- removes collection items
- reset() : static
- resets collection
- save() : static
- where() : static
- finds elements
- getDb() : Database
- gets db service
Constants
ITEMS_PER_PAGE
public
mixed
ITEMS_PER_PAGE
= 50
Properties
$className
protected
string
$className
$items
protected
array<string|int, mixed>
$items
= []
collection loaded items
$stmt
protected
Result|null
$stmt
= null
collection statement
Methods
__construct()
public
__construct(string $className) : mixed
Parameters
- $className : string
addCondition()
adds condition to collection
public
addCondition([array<string|int, mixed>|string|null $condition = [] ]) : static
Parameters
- $condition : array<string|int, mixed>|string|null = []
Return values
staticaddGroupBy()
public
addGroupBy(string $groupBy) : static
Parameters
- $groupBy : string
Return values
staticaddHaving()
public
addHaving(string $having) : static
Parameters
- $having : string
Return values
staticaddOrder()
adds order to collection
public
addOrder([array<string|int, mixed>|string $order = [] ][, string $position = 'end' ]) : static
Parameters
- $order : array<string|int, mixed>|string = []
- $position : string = 'end'
Return values
staticaddSelect()
public
addSelect(string $select) : static
Parameters
- $select : string
Return values
staticcount()
public
count() : int
Return values
intdelete()
public
delete() : static
Return values
staticfetchAllDbRows()
public
fetchAllDbRows() : mixed
fetchDbRow()
public
fetchDbRow() : mixed
getFirst()
public
getFirst() : mixed
getItems()
gets collection items
public
getItems() : array<string|int, mixed>
Return values
array<string|int, mixed>getIterator()
public
getIterator() : Traversable|ArrayIterator
Return values
Traversable|ArrayIteratorgetSelect()
get collection select object
public
getSelect() : Result
Return values
ResultgetTableName()
gets collection objects table name
public
getTableName() : string
Return values
stringlimit()
limit results
public
limit(int $page_size[, int $start = 0 ]) : static
Parameters
- $page_size : int
- $start : int = 0
Return values
staticload()
loads collection items
public
load() : static
Return values
staticoffsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
paginate()
return subset of found items (useful for paginate)
public
paginate(Request $request[, int $page_size = self::ITEMS_PER_PAGE ]) : array<string|int, mixed>
Parameters
- $request : Request
- $page_size : int = self::ITEMS_PER_PAGE
Tags
Return values
array<string|int, mixed>persist()
persists collection items
public
persist() : static
Return values
staticremove()
removes collection items
public
remove() : static
Return values
staticreset()
resets collection
public
reset() : static
Return values
staticsave()
public
save() : static
Return values
staticwhere()
finds elements
public
where(array<string|int, mixed>|string $condition[, array<string|int, mixed> $order = [] ][, int $page_size = null ][, int $start = 0 ]) : static
Parameters
- $condition : array<string|int, mixed>|string
- $order : array<string|int, mixed> = []
- $page_size : int = null
- $start : int = 0
Tags
Return values
staticgetDb()
gets db service
protected
getDb() : Database