Menu

## Builder extends ContractBuilder
in package
Uses AggregateTrait, ParseTrait, FilterTrait

Builder.php : 25

### Table of Contents

#### Properties

$columns : mixed|string
$database : Core
$preventLimit : bool
$table : string
$where : array<string|int, mixed>

#### Methods

__construct() : mixed
all() : array<string|int, mixed>|null
  Returns all items from the Database. If a callback is passed, it will be called on each item in the resultset
avg() : string|null
build() : mixed
builder() : static
count() : int|null
delete() : PDOStatement|null
first() : object|null
  Same as get() but returns the first item of the resultset
get() : object|null
  Returns one item from the Database
group() : mixed
having() : $this
  Adds a 'having' clause to the query
limit() : static
match() : static
max() : string|null
min() : string|null
orderBy() : $this
  Orders the query by certain value.
startAt() : static
sum() : string|null
where() : static
runGet() : array<string|int, mixed>|null
runSelect() : array<string|int, mixed>|null

### Properties

#### $columns

Builder.php : 37
`private mixed|string $columns = "*"`

#### $database

Builder.php : 29
`private Core $database`

#### $preventLimit

Builder.php : 31
`private bool $preventLimit = false`

#### $table

Builder.php : 27
`private string $table`

#### $where

Builder.php : 33
`private array<string|int, mixed> $where = []`

### Methods

#### __construct()

Builder.php : 43
`public __construct(mixed $table, Core $database[, mixed $columns = "*" ][, mixed $where = [] ]) : mixed`

##### Parameters

$table : mixed
$database : Core
$columns : mixed = "*"
$where : mixed = []

#### all()

ParseTrait.php : 57

Returns all items from the Database. 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

#### avg()

AggregateTrait.php : 53
`public avg(string $column, array<string|int, mixed>|null $where) : string|null`

##### Parameters

$column : string
$where : array<string|int, mixed>|null

##### Tags

see
  Core::avg()

##### Return values

string|null

#### build()

Builder.php : 87
`public build() : mixed`

#### builder()

ContractBuilder.php : 21
`public static builder(mixed ...$args) : static`

##### Parameters

$args : mixed

##### Return values

static

#### count()

AggregateTrait.php : 27
`public count([string|null $column = null ][, array<string|int, mixed>|null $where = null ]) : int|null`

##### Parameters

$column : string|null = null
$where : array<string|int, mixed>|null = null

##### Tags

see
  Core::count()

##### Return values

int|null

#### delete()

ParseTrait.php : 77
`public delete(int|array<string|int, mixed>|string $where[, string|null $idField = 'id' ]) : PDOStatement|null`

##### Parameters

$where : int|array<string|int, mixed>|string
$idField : string|null = 'id'

##### Tags

example

        $res1 = Porm::from('users')->delete(1); // deletes a user with id 1
        $res2 = Porm::from('users')->delete(['name' => 'John']); // deletes a user with name John

##### Return values

PDOStatement|null

#### first()

Builder.php : 76

Same as get() but returns the first item of the resultset

`public first() : object|null`

##### Return values

object|null

#### get()

Builder.php : 62

Returns one item from the Database

`public get([array<string|int, mixed>|int|null $where = null ]) : object|null`

##### Parameters

$where : array<string|int, mixed>|int|null = null

##### Tags

example

      $row = Table::from('user')
           ->filter(['last_name' => 'Ezra'])
           ->get();

##### Return values

object|null

#### group()

FilterTrait.php : 63
`public group(string|array<string|int, mixed> $group) : mixed`

##### Parameters

$group : string|array<string|int, mixed>

#### having()

FilterTrait.php : 76

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

#### limit()

FilterTrait.php : 24
`public limit(int $limit) : static`

##### Parameters

$limit : int

##### Tags

throws
  Exception

##### Return values

static

#### match()

Builder.php : 81
`public match(mixed $columns, mixed $keyword[, mixed $mode = 'natural' ]) : static`

##### Parameters

$columns : mixed
$keyword : mixed
$mode : mixed = 'natural'

##### Return values

static

#### max()

AggregateTrait.php : 65
`public max(string $column, array<string|int, mixed>|null $where) : string|null`

##### Parameters

$column : string
$where : array<string|int, mixed>|null

##### Tags

see
  Core::max()

##### Return values

string|null

#### min()

AggregateTrait.php : 77
`public min(string $column, array<string|int, mixed>|null $where) : string|null`

##### Parameters

$column : string
$where : array<string|int, mixed>|null

##### Tags

see
  Core::min()

##### Return values

string|null

#### orderBy()

FilterTrait.php : 106

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

#### startAt()

FilterTrait.php : 46
`public startAt([int $startPoint = 0 ]) : static`

##### Parameters

$startPoint : int = 0

##### Return values

static

#### sum()

AggregateTrait.php : 41
`public sum(string $column, array<string|int, mixed>|null $where) : string|null`

##### Parameters

$column : string
$where : array<string|int, mixed>|null

##### Tags

see
  Core::sum()

##### Return values

string|null

#### where()

ParseTrait.php : 62
`public where(array<string|int, mixed> $where) : static`

##### Parameters

$where : array<string|int, mixed>

##### Return values

static

#### runGet()

ParseTrait.php : 33
`private runGet() : array<string|int, mixed>|null`

##### Return values

array<string|int, mixed>|null

#### runSelect()

ParseTrait.php : 24
`private runSelect(callable|null $callback) : array<string|int, mixed>|null`

##### Parameters

$callback : callable|null

##### Return values

array<string|int, mixed>|null

## Search results