Methods

setDb()

setDb(mixed|string  $db) : static

Parameters

mixed|string $db

Returns

static

setModel()

setModel(\ManaPHP\Data\Model  $model) : static

Parameters

\ManaPHP\Data\Model $model

Returns

static

getModel()

getModel() : \ManaPHP\Data\Model

Returns

\ManaPHP\Data\Model

shard()

shard(callable  $strategy) : static

Parameters

callable $strategy

Returns

static

from()

from(string  $table, string  $alias = null) : static

Parameters

string $table
string $alias

Returns

static

select()

select(string|array  $fields) : static

Parameters

string|array $fields

=get_object_vars(new Model)

Returns

static

distinct()

distinct(boolean  $distinct = true) : static

Sets SELECT DISTINCT / SELECT ALL flag

Parameters

boolean $distinct

Returns

static

where()

where(array  $filters) : static

Appends a condition to the current conditions using a AND operator

Parameters

array $filters

=get_object_vars(new Model)

Returns

static

whereEq()

whereEq(string  $field, mixed  $value) : static

Parameters

string $field

=key(get_object_vars(new Model))

mixed $value

Returns

static

whereCmp()

whereCmp(string  $field, string  $operator, mixed  $value) : static

Parameters

string $field

=key(get_object_vars(new Model))

string $operator
mixed $value

Returns

static

whereMod()

whereMod(string  $field, integer  $divisor, integer  $remainder) : static

Parameters

string $field

=key(get_object_vars(new Model))

integer $divisor
integer $remainder

Returns

static

whereExpr()

whereExpr(string  $expr, array  $bind = null) : static

Parameters

string $expr
array $bind

Returns

static

search()

search(array  $filters) : static

Parameters

array $filters

=get_object_vars(new Model)

Returns

static

whereBetween()

whereBetween(string  $field, integer|float|string  $min, integer|float|string  $max) : static

Appends a BETWEEN condition to the current conditions

Parameters

string $field

=key(get_object_vars(new Model))

integer|float|string $min
integer|float|string $max

Returns

static

whereNotBetween()

whereNotBetween(string  $field, integer|float|string  $min, integer|float|string  $max) : static

Appends a NOT BETWEEN condition to the current conditions

Parameters

string $field

=key(get_object_vars(new Model))

integer|float|string $min
integer|float|string $max

Returns

static

whereDateBetween()

whereDateBetween(string  $field, integer|string  $min, integer|string  $max) : static

Parameters

string $field

=key(get_object_vars(new Model))

integer|string $min
integer|string $max

Returns

static

whereIn()

whereIn(string  $field, array  $values) : static

Appends an IN condition to the current conditions

Parameters

string $field

=key(get_object_vars(new Model))

array $values

Returns

static

whereNotIn()

whereNotIn(string  $field, array  $values) : static

Appends a NOT IN condition to the current conditions

Parameters

string $field

=key(get_object_vars(new Model))

array $values

Returns

static

whereInset()

whereInset(string  $field, string  $value) : static

Parameters

string $field

=key(get_object_vars(new Model))

string $value

Returns

static

whereNotInset()

whereNotInset(string  $field, string  $value) : static

Parameters

string $field

=key(get_object_vars(new Model))

string $value

Returns

static

whereContains()

whereContains(string|array  $fields, string  $value) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $value

Returns

static

whereNotContains()

whereNotContains(string|array  $fields, string  $value) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $value

Returns

static

whereStartsWith()

whereStartsWith(string|array  $fields, string  $value, integer  $length = null) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $value
integer $length

Returns

static

whereNotStartsWith()

whereNotStartsWith(string|array  $fields, string  $value, integer  $length = null) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $value
integer $length

Returns

static

whereEndsWith()

whereEndsWith(string|array  $fields, string  $value) : static

Parameters

string|array $fields

=get_object_vars(new Model)?: key(get_object_vars(new Model))

string $value

Returns

static

whereNotEndsWith()

whereNotEndsWith(string|array  $fields, string  $value) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $value

Returns

static

whereLike()

whereLike(string|array  $fields, string  $like) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $like

Returns

static

whereNotLike()

whereNotLike(string|array  $fields, string  $like) : static

Parameters

string|array $fields

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

string $like

Returns

static

whereRegex()

whereRegex(string  $field, string  $regex, string  $flags = '') : static

Parameters

string $field

=key(get_object_vars(new Model))

string $regex
string $flags

Returns

static

whereNotRegex()

whereNotRegex(string  $field, string  $regex, string  $flags = '') : static

Parameters

string $field

=key(get_object_vars(new Model))

string $regex
string $flags

Returns

static

whereNull()

whereNull(string  $field) : static

Parameters

string $field

=key(get_object_vars(new Model))

Returns

static

whereNotNull()

whereNotNull(string  $field) : static

Parameters

string $field

=key(get_object_vars(new Model))

Returns

static

orderBy()

orderBy(string|array  $orderBy) : static

Sets a ORDER BY condition clause

Parameters

string|array $orderBy

=get_object_vars(new Model) ?: key(get_object_vars(new Model)) ?: [$k=>SORT_ASC, $k=>SORT_DESC]

Returns

static

indexBy()

indexBy(callable|string|array  $indexBy) : static

Parameters

callable|string|array $indexBy

=key(get_object_vars(new Model))

Returns

static

groupBy()

groupBy(string|array  $groupBy) : static

Sets a GROUP BY clause

Parameters

string|array $groupBy

=get_object_vars(new Model) ?: key(get_object_vars(new Model))

Returns

static

options()

options(array  $options) : static

Parameters

array $options

Returns

static

with()

with(string|array  $with) : static

Parameters

string|array $with

Returns

static

limit()

limit(integer  $limit, integer  $offset = null) : static

Sets a LIMIT clause, optionally a offset clause

Parameters

integer $limit
integer $offset

Returns

static

page()

page(integer  $size = null, integer  $page = null) : static

Parameters

integer $size
integer $page

Returns

static

forceUseMaster()

forceUseMaster(boolean  $forceUseMaster = true) : static

Parameters

boolean $forceUseMaster

Returns

static

execute()

execute() : array

Returns

array

aggregate()

aggregate(array  $expr) : array

Parameters

array $expr

Returns

array

paginate()

paginate(integer  $size = null, integer  $page = null) : \ManaPHP\Data\Paginator

Parameters

integer $size
integer $page

Returns

\ManaPHP\Data\Paginator

setFetchType()

setFetchType(boolean  $multiple) : static

Parameters

boolean $multiple

Returns

static

fetch()

fetch(boolean  $asArray = false) : array<mixed,\ManaPHP\Data\Model>|\ManaPHP\Data\Model|array|null|\ManaPHP\Data\Query\Row

Parameters

boolean $asArray

Returns

array<mixed,\ManaPHP\Data\Model>|\ManaPHP\Data\Model|array|null|\ManaPHP\Data\Query\Row

first()

first() : array|null

Returns

array|null

get()

get() : array

Returns

array

all()

all() : array

Returns

array

value()

value(string  $field, mixed  $default = null) : mixed

Parameters

string $field

=key(get_object_vars(new Model))

mixed $default

Returns

mixed

values()

values(string  $field) : array

Parameters

string $field

=key(get_object_vars(new Model))

Returns

array

exists()

exists() : boolean

Returns

boolean

count()

count(string  $field = '*') : integer

Parameters

string $field

=key(get_object_vars(new Model))

Returns

integer

sum()

sum(string  $field) : integer|float|null

Parameters

string $field

=key(get_object_vars(new Model))

Returns

integer|float|null

max()

max(string  $field) : integer|float|null

Parameters

string $field

=key(get_object_vars(new Model))

Returns

integer|float|null

min()

min(string  $field) : integer|float|null

Parameters

string $field

=key(get_object_vars(new Model))

Returns

integer|float|null

avg()

avg(string  $field) : float|null

Parameters

string $field

=key(get_object_vars(new Model))

Returns

float|null

delete()

delete() : integer

Returns

integer

update()

update(array  $fieldValues) : integer

Parameters

array $fieldValues

=get_object_vars(new Model)

Returns

integer

when()

when(callable  $call) : static

Parameters

callable $call

Returns

static

whereDate()

whereDate(string  $field, string|integer  $date) : static

Parameters

string $field

=key(get_object_vars(new Model))

string|integer $date

Returns

static

whereMonth()

whereMonth(string  $field, string|integer  $date) : static

Parameters

string $field

=key(get_object_vars(new Model))

string|integer $date

Returns

static

whereYear()

whereYear(string  $field, string|integer  $date) : static

Parameters

string $field
string|integer $date

Returns

static

where1v1()

where1v1(string  $id, string  $value) : static

Parameters

string $id
string $value

Returns

static

join()

join(string  $table, string  $condition = null, string  $alias = null, string  $type = null) : static

Parameters

string $table
string $condition
string $alias
string $type

Returns

static

innerJoin()

innerJoin(string  $table, string  $condition = null, string  $alias = null) : static

Parameters

string $table
string $condition
string $alias

Returns

static

leftJoin()

leftJoin(string  $table, string  $condition = null, string  $alias = null) : static

Parameters

string $table
string $condition
string $alias

Returns

static

rightJoin()

rightJoin(string  $table, string  $condition = null, string  $alias = null) : static

Parameters

string $table
string $condition
string $alias

Returns

static

whereRaw()

whereRaw(string  $filter, array  $bind = null) : static

Parameters

string $filter
array $bind

Returns

static

having()

having(string|array  $having, array  $bind = array()) : static

Parameters

string|array $having
array $bind

Returns

static

getSql()

getSql() : string

Returns

string