class Builder extends Plugin

Builder

Extends QueryBuilder to add findBy options and includes the base Paginator helpers.

Methods

__construct($parentClass)

No description

isPublished()

No description

wherePublished()

No description

withTags($tags = [], $mode = 'AND')

No description

byTags($tags = [], $mode = 'AND')

No description

byAuthors($authors = [], $mode = 'AND')

No description

find()

No description

setPage(int $page)

Set the page number

setLimit(int $limit)

Set return limit

setBuilder(QueryBuilder $builder)

Reset the query builder

setFilter(callback $filter)

Set the result filter

paginate(array $return = [])

Paginate results.

Object
getPagination()

Return the paginator object

Object
getItems()

Return the fetched items

__call(string $f, array $args)

Forward fluent calls for the querybuilder to the actual querybuilder

Details

at line 57
__construct($parentClass)

Parameters

$parentClass

at line 63
isPublished()

at line 67
wherePublished()

at line 72
withTags($tags = [], $mode = 'AND')

Parameters

$tags
$mode

at line 77
byTags($tags = [], $mode = 'AND')

Parameters

$tags
$mode

at line 147
byAuthors($authors = [], $mode = 'AND')

Parameters

$authors
$mode

at line 177
find()

at line 187
Builder setPage(int $page)

Set the page number

Parameters

int $page page

Return Value

Builder

at line 198
Builder setLimit(int $limit)

Set return limit

Parameters

int $limit

Return Value

Builder

at line 210
Builder setBuilder(QueryBuilder $builder)

Reset the query builder

Parameters

QueryBuilder $builder

Return Value

Builder

at line 236
Builder setFilter(callback $filter)

Set the result filter

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

callback $filter

Return Value

Builder

at line 249
Builder paginate(array $return = [])

Paginate results.

Parameters

array $return array to fill with return data

Return Value

Builder

at line 298
Object getPagination()

Return the paginator object

Return Value

Object

at line 307
Object getItems()

Return the fetched items

Return Value

Object

at line 320
Builder __call(string $f, array $args)

Forward fluent calls for the querybuilder to the actual querybuilder

Parameters

string $f method name
array $args arguments

Return Value

Builder