Pionia Core

Join extends ContractBuilder
in package
Uses JoinParseTrait, FilterTrait

Builds relationships across multiple tables.

Table of Contents

Properties

$columns  : mixed|string
$database  : Piql
$joins  : array<string|int, mixed>
List of all joins that are about to be applied.These are in a medoo format.
$preventLimit  : bool
$table  : string
$where  : array<string|int, mixed>

Methods

__construct()  : mixed
all()  : array<string|int, mixed>|null
Returns all items from the CDatabase. If a callback is passed, it will be called on each item in the resultset
build()  : Join
builder()  : static
count()  : int|null
full()  : static
getJoins()  : array<string|int, mixed>
Returns the medoo-like join array that was generated after chaining multiple joins
group()  : mixed
having()  : $this
Adds a 'having' clause to the query
inner()  : static
left()  : static
limit()  : static
orderBy()  : $this
Orders the query by certain value.
right()  : static
startAt()  : static
where()  : static
join()  : static
runSelect()  : array<string|int, mixed>|null

Properties

$columns

private mixed|string $columns

$joins

List of all joins that are about to be applied.These are in a medoo format.

private array<string|int, mixed> $joins = []

$preventLimit

private bool $preventLimit = false

$table

private string $table

$where

private array<string|int, mixed> $where

Methods

__construct()

public __construct(mixed $table, Piql $database[, mixed $columns = "*" ][, mixed $where = [] ]) : mixed
Parameters
$table : mixed
$database : Piql
$columns : mixed = "*"
$where : mixed = []

all()

Returns all items from the CDatabase. If a callback is passed, it will be called on each item in the resultset

public all([callable|null $callback = null ]) : array<string|int, mixed>|null
Parameters
$callback : callable|null = null

This is the receiver for the current resultset

Tags
example
// Assignment method
$row = Table::from('user')
    ->filter(['last_name' => 'Ezra'])
   ->all();

// Callback method- this is little bit faster than the assignment method
Table::from('user')
   ->filter(['last_name' => 'Ezra'])
  ->all(function($row) {
     echo $row->first_name;
 });
Return values
array<string|int, mixed>|null

builder()

public static builder(mixed ...$args) : static
Parameters
$args : mixed
Return values
static

count()

public count([string|null $column = "*" ][, array<string|int, mixed>|null $where = null ]) : int|null
Parameters
$column : string|null = "*"
$where : array<string|int, mixed>|null = null
Tags
see
Core::count()
Return values
int|null

full()

public full(mixed $table, string|array<string|int, mixed> $on_or_using[, string|null $alias = null ]) : static
Parameters
$table : mixed
$on_or_using : string|array<string|int, mixed>
$alias : string|null = null
Return values
static

getJoins()

Returns the medoo-like join array that was generated after chaining multiple joins

public getJoins() : array<string|int, mixed>
Return values
array<string|int, mixed>

group()

public group(string|array<string|int, mixed> $group) : mixed
Parameters
$group : string|array<string|int, mixed>

having()

Adds a 'having' clause to the query

public having(string $column, mixed $value[, string|null $needle = null ]) : $this
Parameters
$column : string
$value : mixed
$needle : string|null = null

can be >, <, !,>=, <=. >< and <> are available for datetime

Return values
$this

inner()

public inner(mixed $table, string|array<string|int, mixed> $on_or_using[, string|null $alias = null ]) : static
Parameters
$table : mixed
$on_or_using : string|array<string|int, mixed>
$alias : string|null = null
Return values
static

left()

public left(mixed $table, string|array<string|int, mixed> $on_or_using[, string|null $alias = null ]) : static
Parameters
$table : mixed
$on_or_using : string|array<string|int, mixed>
$alias : string|null = null
Return values
static

limit()

public limit(int $limit) : static
Parameters
$limit : int
Tags
throws
Exception
Return values
static

orderBy()

Orders the query by certain value.

public orderBy(string|array<string|int, mixed> $value) : $this
Parameters
$value : string|array<string|int, mixed>
Tags
example
// single column
->filter()
->orderBy("name")

// multiple Order items
->filter()
->orderBy(['name' => 'DESC', 'age' => 'ASC'])
Return values
$this

right()

public right(mixed $table, string|array<string|int, mixed> $on_or_using[, string|null $alias = null ]) : static
Parameters
$table : mixed
$on_or_using : string|array<string|int, mixed>
$alias : string|null = null
Return values
static

startAt()

public startAt([int $startPoint = 0 ]) : static
Parameters
$startPoint : int = 0
Return values
static

where()

public where(array<string|int, mixed> $where) : static
Parameters
$where : array<string|int, mixed>
Return values
static

join()

private join(string $joinTable, string $alias, string|array<string|int, mixed> $on_or_using, string $joinType) : static
Parameters
$joinTable : string
$alias : string
$on_or_using : string|array<string|int, mixed>
$joinType : string
Return values
static

runSelect()

private runSelect(callable|null $callback) : array<string|int, mixed>|null
Parameters
$callback : callable|null
Return values
array<string|int, mixed>|null

        
On this page

Search results