Builder
extends Plugin
in package
Builder
Extends QueryBuilder to add findBy options and includes the base Paginator helpers.
Table of Contents
- $builder : QueryBuilder
- Query builder
- $filter : callable
- Result filter
- $limit : int
- Limit
- $myItems : object
- Returned items
- $myPagination : object
- Pagination object
- $page : int
- Page
- $parentClass : mixed
- __call() : self
- Forward fluent calls for the querybuilder to the actual querybuilder
- __construct() : mixed
- byAuthors() : mixed
- byTags() : mixed
- find() : mixed
- getItems() : object
- Return the fetched items
- getPagination() : object
- Return the paginator object
- isPublished() : mixed
- paginate() : self
- Paginate results.
- setBuilder() : self
- Reset the query builder
- setFilter() : self
- Set the result filter
- setLimit() : self
- Set return limit
- setPage() : self
- Set the page number
- wherePublished() : mixed
- withTags() : mixed
Properties
$builder
Query builder
private
QueryBuilder
$builder
$filter
Result filter
private
callable
$filter
$limit
Limit
private
int
$limit
$myItems
Returned items
private
object
$myItems
$myPagination
Pagination object
private
object
$myPagination
$page
Page
private
int
$page
$parentClass
private
mixed
$parentClass
Methods
__call()
Forward fluent calls for the querybuilder to the actual querybuilder
public
__call(string $f, array<string|int, mixed> $args) : self
Parameters
- $f : string
-
method name
- $args : array<string|int, mixed>
-
arguments
Return values
self —__construct()
public
__construct(mixed $parentClass) : mixed
Parameters
- $parentClass : mixed
Return values
mixed —byAuthors()
public
byAuthors([mixed $authors = [] ][, mixed $mode = 'AND' ]) : mixed
Parameters
- $authors : mixed = []
- $mode : mixed = 'AND'
Return values
mixed —byTags()
public
byTags([mixed $tags = [] ][, mixed $mode = 'AND' ]) : mixed
Parameters
- $tags : mixed = []
- $mode : mixed = 'AND'
Return values
mixed —find()
public
find() : mixed
Return values
mixed —getItems()
Return the fetched items
public
getItems() : object
Return values
object —getPagination()
Return the paginator object
public
getPagination() : object
Return values
object —isPublished()
public
isPublished() : mixed
Return values
mixed —paginate()
Paginate results.
public
paginate([mixed &$return = [] ]) : self
Parameters
- $return : mixed = []
Return values
self —setBuilder()
Reset the query builder
public
setBuilder(QueryBuilder $builder) : self
Parameters
- $builder : QueryBuilder
Return values
self —setFilter()
Set the result filter
public
setFilter(callable $filter) : self
The filter will be passed the individual result model:
$paginator = new Ceo\Helpers\Paginator(1,2) ->from('Ceo\Models\Foo') ->orderBy('created_at desc') ->where('name = :name:', array('name' => $name)) ->andWhere('type = :type:', array('type' => $type)) ->setFilter(function($model) { return $model->toArray(); }) ->paginate();
Parameters
- $filter : callable
Return values
self —setLimit()
Set return limit
public
setLimit(int $limit) : self
Parameters
- $limit : int
Return values
self —setPage()
Set the page number
public
setPage(int $page) : self
Parameters
- $page : int
-
page
Return values
self —wherePublished()
public
wherePublished() : mixed
Return values
mixed —withTags()
public
withTags([mixed $tags = [] ][, mixed $mode = 'AND' ]) : mixed
Parameters
- $tags : mixed = []
- $mode : mixed = 'AND'