Documentation

Record extends AbstractRecord
in package

Record class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
6.5.0

Table of Contents

Properties

$isNew  : bool
Is new record flag
$isTransaction  : bool
Is transaction flag
$prefix  : string|null
Table prefix
$primaryKeys  : array<string|int, mixed>
Primary keys
$relationships  : array<string|int, mixed>
Relationships
$rowGateway  : Row|null
Row gateway
$table  : string|null
Table name
$tableGateway  : Table|null
Table gateway
$with  : array<string|int, mixed>
With relationships
$withChildren  : string|null
With relationship children
$withOptions  : array<string|int, mixed>
With relationship options

Methods

__callStatic()  : Collection|array<string|int, mixed>|null
Call static method for 'findWhere'
__construct()  : mixed
Constructor
__get()  : mixed
Magic method to return the value of $this->rowGateway[$name]
__isset()  : bool
Magic method to return the isset value of $this->rowGateway[$name]
__set()  : void
Magic method to set the property to the value of $this->rowGateway[$name]
__unset()  : void
Magic method to unset $this->rowGateway[$name]
addWith()  : AbstractRecord
Set with relationships
belongsTo()  : Record|BelongsTo
Belongs to relationship
commit()  : void
Commit transaction with the DB adapter
commitTransaction()  : AbstractRecord
Commit transaction
copy()  : static
Copy the record (alias to replicate)
count()  : int
Method to get count of fields in row gateway
countRows()  : int
Get the count of rows returned in the result
db()  : AbstractAdapter
Get DB adapter (alias)
decrement()  : void
Decrement the record column and save
delete()  : void
Delete the record
execute()  : Collection|array<string|int, mixed>|int
Static method to execute a custom prepared SQL statement.
findAll()  : Collection|array<string|int, mixed>|static
Find all static method
findBy()  : Collection|array<string|int, mixed>
Find by static method
findById()  : static|array<string|int, mixed>
Find by ID static method
findByOrCreate()  : static|Collection|array<string|int, mixed>
Find by or create static method
findIn()  : array<string|int, mixed>
Find in static method
findLatest()  : static|array<string|int, mixed>
Find latest static method
findOne()  : static|array<string|int, mixed>
Find one static method
findOneOrCreate()  : static|array<string|int, mixed>
Find one or create static method
findWhereBetween()  : void
findWhereEquals()  : void
findWhereGreaterThan()  : void
findWhereGreaterThanOrEqual()  : void
findWhereIn()  : void
findWhereLessThan()  : void
findWhereLessThanOrEqual()  : void
findWhereLike()  : void
findWhereNotBetween()  : void
findWhereNotEquals()  : void
findWhereNotIn()  : void
findWhereNotLike()  : void
findWhereNotNull()  : void
findWhereNull()  : void
getAll()  : Collection|array<string|int, mixed>
Get all method
getBy()  : Collection|array<string|int, mixed>
Get by method
getById()  : static|array<string|int, mixed>
Get by ID method
getDb()  : AbstractAdapter
Get DB adapter
getDirty()  : array<string|int, mixed>
Get row's dirty columns
getFullTable()  : string
Get the full table name (prefix + table)
getIn()  : array<string|int, mixed>
Get in method
getIterator()  : ArrayIterator
Method to iterate over the columns
getOne()  : static|array<string|int, mixed>
Get one method
getPrefix()  : string|null
Get the table prefix
getPrimaryKeys()  : array<string|int, mixed>
Get the primary keys
getPrimaryValues()  : array<string|int, mixed>
Get the primary values
getRelationship()  : mixed
Get relationship
getRelationships()  : array<string|int, mixed>
Get relationships
getRowGateway()  : Row|null
Get the row gateway
getRows()  : Collection
Get the rows
getSql()  : Sql
Get SQL builder
getTable()  : string|null
Get the table
getTableGateway()  : Table|null
Get the table gateway
getTableInfo()  : array<string|int, mixed>
Static method to get the total count of a set from the DB table
getTotal()  : int
Static method to get the total count of a set from the DB table
getWithRelationships()  : AbstractRecord
Get with relationships
getWiths()  : array<string|int, mixed>
Get with relationships
hasDb()  : bool
Check for a DB adapter
hasMany()  : Collection|HasMany
Has many relationship
hasOne()  : Record|HasOne
Has one relationship
hasOneOf()  : Record|HasOneOf
Has one of relationship
hasRelationship()  : bool
Has relationship
hasRelationships()  : bool
Get relationships
hasRows()  : bool
Determine if the result has rows
hasWith()  : bool
Determine if there is specific with relationship
hasWiths()  : bool
Determine if there are with relationships
increment()  : void
Increment the record column and save
isDirty()  : bool
Check if row is dirty
isTransaction()  : bool
Is transaction
offsetExists()  : bool
ArrayAccess offsetExists
offsetGet()  : mixed
ArrayAccess offsetGet
offsetSet()  : void
ArrayAccess offsetSet
offsetUnset()  : void
ArrayAccess offsetUnset
processRow()  : mixed
Process a table row
processRows()  : array<string|int, mixed>
Process table rows
processWithRelationships()  : AbstractRecord
Process with relationships
query()  : Collection|array<string|int, mixed>|int
Static method to execute a custom SQL query.
replicate()  : static
Replicate the record
resetDirty()  : void
Reset row's dirty columns
rollback()  : Exception|null
Rollback transaction with the DB adapter
rollbackTransaction()  : AbstractRecord
Rollback transaction
rows()  : Collection
Get the rows (alias method)
save()  : void
Save or update the record
setColumns()  : AbstractRecord
Set all the table column values at once
setDb()  : void
Set DB adapter
setDefaultDb()  : void
Set DB adapter
setPrefix()  : AbstractRecord
Set the table prefix
setPrimaryKeys()  : AbstractRecord
Set the primary keys
setRelationship()  : AbstractRecord
Set relationship
setRows()  : AbstractRecord
Set all the table rows at once
setTable()  : AbstractRecord
Set the table
setTableFromClassName()  : AbstractRecord
Set the table from a class name
sql()  : Sql
Get SQL builder (alias)
start()  : static|null
Start transaction with the DB adapter. When called on a descendent class, construct a new object and use it for transaction management.
startTransaction()  : AbstractRecord
Start transaction
table()  : string
Get table name
toArray()  : array<string|int, mixed>
Get column values as array
transaction()  : void
Execute complete transaction with the DB adapter
with()  : static
With a 1:many relationship (eager-loading)

Properties

$isTransaction

Is transaction flag

protected bool $isTransaction = false

$primaryKeys

Primary keys

protected array<string|int, mixed> $primaryKeys = ['id']

$relationships

Relationships

protected array<string|int, mixed> $relationships = []

$with

With relationships

protected array<string|int, mixed> $with = []

$withChildren

With relationship children

protected string|null $withChildren = null

$withOptions

With relationship options

protected array<string|int, mixed> $withOptions = []

Methods

__callStatic()

Call static method for 'findWhere'

public static __callStatic(string $name, array<string|int, mixed> $arguments) : Collection|array<string|int, mixed>|null

$users = Users::findWhereUsername($value);

$users = Users::findWhereEquals($column, $value); $users = Users::findWhereNotEquals($column, $value); $users = Users::findWhereGreaterThan($column, $value); $users = Users::findWhereGreaterThanOrEqual($column, $value); $users = Users::findWhereLessThan($column, $value); $users = Users::findWhereLessThanOrEqual($column, $value);

$users = Users::findWhereLike($column, $value); $users = Users::findWhereNotLike($column, $value);

$users = Users::findWhereIn($column, $values); $users = Users::findWhereNotIn($column, $values);

$users = Users::findWhereBetween($column, $values); $users = Users::findWhereNotBetween($column, $values);

$users = Users::findWhereNull($column); $users = Users::findWhereNotNull($column);

Parameters
$name : string
$arguments : array<string|int, mixed>
Return values
Collection|array<string|int, mixed>|null

__construct()

Constructor

public __construct() : mixed

Instantiate the database record object

Optional parameters are an array of column values, db adapter, or a table name

Tags
throws
Exception|Exception

__get()

Magic method to return the value of $this->rowGateway[$name]

public __get(string $name) : mixed
Parameters
$name : string

__isset()

Magic method to return the isset value of $this->rowGateway[$name]

public __isset(string $name) : bool
Parameters
$name : string
Return values
bool

__set()

Magic method to set the property to the value of $this->rowGateway[$name]

public __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

__unset()

Magic method to unset $this->rowGateway[$name]

public __unset(string $name) : void
Parameters
$name : string

addWith()

Set with relationships

public addWith(string $name[, array<string|int, mixed>|null $options = null ]) : AbstractRecord
Parameters
$name : string
$options : array<string|int, mixed>|null = null
Return values
AbstractRecord

belongsTo()

Belongs to relationship

public belongsTo(string $foreignTable, string $foreignKey[, array<string|int, mixed>|null $options = null ][, bool $eager = false ]) : Record|BelongsTo
Parameters
$foreignTable : string
$foreignKey : string
$options : array<string|int, mixed>|null = null
$eager : bool = false
Return values
Record|BelongsTo

commit()

Commit transaction with the DB adapter

public static commit() : void
Tags
throws
Exception

copy()

Copy the record (alias to replicate)

public copy([array<string|int, mixed> $replace = [] ]) : static
Parameters
$replace : array<string|int, mixed> = []
Return values
static

count()

Method to get count of fields in row gateway

public count() : int
Return values
int

countRows()

Get the count of rows returned in the result

public countRows() : int
Return values
int

decrement()

Decrement the record column and save

public decrement(string $column[, int $amount = 1 ]) : void
Parameters
$column : string
$amount : int = 1

delete()

Delete the record

public delete([array<string|int, mixed>|null $columns = null ][, bool $commit = true ]) : void
Parameters
$columns : array<string|int, mixed>|null = null
$commit : bool = true

execute()

Static method to execute a custom prepared SQL statement.

public static execute(mixed $sql[, array<string|int, mixed> $params = [] ][, bool $toArray = false ]) : Collection|array<string|int, mixed>|int
Parameters
$sql : mixed
$params : array<string|int, mixed> = []
$toArray : bool = false
Return values
Collection|array<string|int, mixed>|int

findAll()

Find all static method

public static findAll([array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : Collection|array<string|int, mixed>|static
Parameters
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
Collection|array<string|int, mixed>|static

findBy()

Find by static method

public static findBy([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool|array<string|int, mixed> $toArray = false ]) : Collection|array<string|int, mixed>
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool|array<string|int, mixed> = false
Return values
Collection|array<string|int, mixed>

findById()

Find by ID static method

public static findById(mixed $id[, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : static|array<string|int, mixed>
Parameters
$id : mixed
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
static|array<string|int, mixed>

findByOrCreate()

Find by or create static method

public static findByOrCreate([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool|array<string|int, mixed> $toArray = false ]) : static|Collection|array<string|int, mixed>
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool|array<string|int, mixed> = false
Return values
static|Collection|array<string|int, mixed>

findIn()

Find in static method

public static findIn(string $key, array<string|int, mixed> $values[, array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : array<string|int, mixed>
Parameters
$key : string
$values : array<string|int, mixed>
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
array<string|int, mixed>

findLatest()

Find latest static method

public static findLatest([string|null $by = null ][, array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : static|array<string|int, mixed>
Parameters
$by : string|null = null
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
static|array<string|int, mixed>

findOne()

Find one static method

public static findOne([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : static|array<string|int, mixed>
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
static|array<string|int, mixed>

findOneOrCreate()

Find one or create static method

public static findOneOrCreate([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : static|array<string|int, mixed>
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
static|array<string|int, mixed>

findWhereBetween()

public static findWhereBetween(mixed $column, mixed $values, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$values : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereEquals()

public static findWhereEquals(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereGreaterThan()

public static findWhereGreaterThan(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereGreaterThanOrEqual()

public static findWhereGreaterThanOrEqual(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereIn()

public static findWhereIn(mixed $column, mixed $values, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$values : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereLessThan()

public static findWhereLessThan(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereLessThanOrEqual()

public static findWhereLessThanOrEqual(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereLike()

public static findWhereLike(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereNotBetween()

public static findWhereNotBetween(mixed $column, mixed $values, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$values : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereNotEquals()

public static findWhereNotEquals(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereNotIn()

public static findWhereNotIn(mixed $column, mixed $values, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$values : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereNotLike()

public static findWhereNotLike(mixed $column, mixed $value, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$value : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereNotNull()

public static findWhereNotNull(mixed $column, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

findWhereNull()

public static findWhereNull(mixed $column, array<string|int, mixed> $options = null, bool|array<string|int, mixed> $toArray = false) : void
Parameters
$column : mixed
$options = null : array<string|int, mixed>
$toArray = false : bool|array<string|int, mixed>

getAll()

Get all method

public getAll([array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : Collection|array<string|int, mixed>
Parameters
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
Collection|array<string|int, mixed>

getBy()

Get by method

public getBy([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : Collection|array<string|int, mixed>
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
Collection|array<string|int, mixed>

getById()

Get by ID method

public getById(mixed $id[, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : static|array<string|int, mixed>
Parameters
$id : mixed
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
static|array<string|int, mixed>

getDirty()

Get row's dirty columns

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

getFullTable()

Get the full table name (prefix + table)

public getFullTable() : string
Return values
string

getIn()

Get in method

public getIn(string $key, array<string|int, mixed> $values[, array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : array<string|int, mixed>
Parameters
$key : string
$values : array<string|int, mixed>
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
array<string|int, mixed>

getIterator()

Method to iterate over the columns

public getIterator() : ArrayIterator
Return values
ArrayIterator

getOne()

Get one method

public getOne([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ][, bool $toArray = false ]) : static|array<string|int, mixed>
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
static|array<string|int, mixed>

getPrefix()

Get the table prefix

public getPrefix() : string|null
Return values
string|null

getPrimaryKeys()

Get the primary keys

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

getPrimaryValues()

Get the primary values

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

getRelationship()

Get relationship

public getRelationship(string $name) : mixed
Parameters
$name : string

getRelationships()

Get relationships

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

getSql()

Get SQL builder

public static getSql() : Sql
Return values
Sql

getTable()

Get the table

public getTable() : string|null
Return values
string|null

getTableInfo()

Static method to get the total count of a set from the DB table

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

getTotal()

Static method to get the total count of a set from the DB table

public static getTotal([array<string|int, mixed>|null $columns = null ][, array<string|int, mixed>|null $options = null ]) : int
Parameters
$columns : array<string|int, mixed>|null = null
$options : array<string|int, mixed>|null = null
Return values
int

getWiths()

Get with relationships

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

hasDb()

Check for a DB adapter

public static hasDb() : bool
Return values
bool

hasMany()

Has many relationship

public hasMany(string $foreignTable, string $foreignKey[, array<string|int, mixed>|null $options = null ][, bool $eager = false ]) : Collection|HasMany
Parameters
$foreignTable : string
$foreignKey : string
$options : array<string|int, mixed>|null = null
$eager : bool = false
Return values
Collection|HasMany

hasOne()

Has one relationship

public hasOne(string $foreignTable, string $foreignKey[, array<string|int, mixed>|null $options = null ][, bool $eager = false ]) : Record|HasOne
Parameters
$foreignTable : string
$foreignKey : string
$options : array<string|int, mixed>|null = null
$eager : bool = false
Return values
Record|HasOne

hasOneOf()

Has one of relationship

public hasOneOf(string $foreignTable, string $foreignKey[, array<string|int, mixed>|null $options = null ][, bool $eager = false ]) : Record|HasOneOf
Parameters
$foreignTable : string
$foreignKey : string
$options : array<string|int, mixed>|null = null
$eager : bool = false
Return values
Record|HasOneOf

hasRelationship()

Has relationship

public hasRelationship(string $name) : bool
Parameters
$name : string
Return values
bool

hasRelationships()

Get relationships

public hasRelationships() : bool
Return values
bool

hasRows()

Determine if the result has rows

public hasRows() : bool
Return values
bool

hasWith()

Determine if there is specific with relationship

public hasWith(string $name) : bool
Parameters
$name : string
Return values
bool

hasWiths()

Determine if there are with relationships

public hasWiths() : bool
Return values
bool

increment()

Increment the record column and save

public increment(string $column[, int $amount = 1 ]) : void
Parameters
$column : string
$amount : int = 1

isDirty()

Check if row is dirty

public isDirty() : bool
Return values
bool

isTransaction()

Is transaction

public isTransaction() : bool
Return values
bool

offsetExists()

ArrayAccess offsetExists

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

ArrayAccess offsetGet

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

ArrayAccess offsetSet

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

ArrayAccess offsetUnset

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

processRow()

Process a table row

public processRow(array<string|int, mixed> $row[, bool $toArray = false ]) : mixed
Parameters
$row : array<string|int, mixed>
$toArray : bool = false

processRows()

Process table rows

public processRows(array<string|int, mixed> $rows[, bool $toArray = false ]) : array<string|int, mixed>
Parameters
$rows : array<string|int, mixed>
$toArray : bool = false
Return values
array<string|int, mixed>

processWithRelationships()

Process with relationships

public processWithRelationships(array<string|int, mixed> $rows) : AbstractRecord
Parameters
$rows : array<string|int, mixed>
Return values
AbstractRecord

query()

Static method to execute a custom SQL query.

public static query(mixed $sql[, bool $toArray = false ]) : Collection|array<string|int, mixed>|int
Parameters
$sql : mixed
$toArray : bool = false
Return values
Collection|array<string|int, mixed>|int

replicate()

Replicate the record

public replicate([array<string|int, mixed> $replace = [] ]) : static
Parameters
$replace : array<string|int, mixed> = []
Return values
static

resetDirty()

Reset row's dirty columns

public resetDirty() : void

rollback()

Rollback transaction with the DB adapter

public static rollback([Exception|null $exception = null ]) : Exception|null
Parameters
$exception : Exception|null = null
Tags
throws
Exception
Return values
Exception|null

save()

Save or update the record

public save([array<string|int, mixed>|null $columns = null ][, bool $commit = true ]) : void
Parameters
$columns : array<string|int, mixed>|null = null
$commit : bool = true
Tags
throws
Exception

setDb()

Set DB adapter

public static setDb(AbstractAdapter $db[, string|null $prefix = null ][, bool $isDefault = false ]) : void
Parameters
$db : AbstractAdapter
$prefix : string|null = null
$isDefault : bool = false

setRows()

Set all the table rows at once

public setRows([array<string|int, mixed>|null $rows = null ][, bool $toArray = false ]) : AbstractRecord
Parameters
$rows : array<string|int, mixed>|null = null
$toArray : bool = false
Return values
AbstractRecord

sql()

Get SQL builder (alias)

public static sql() : Sql
Return values
Sql

start()

Start transaction with the DB adapter. When called on a descendent class, construct a new object and use it for transaction management.

public static start(mixed ...$constructorArgs) : static|null
Parameters
$constructorArgs : mixed

Arguments passed to descendent class constructor

Tags
throws
Exception|Exception
Return values
static|null

table()

Get table name

public static table([bool $quotes = false ]) : string
Parameters
$quotes : bool = false
Return values
string

toArray()

Get column values as array

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

transaction()

Execute complete transaction with the DB adapter

public static transaction(mixed $callable[, mixed $params = null ]) : void
Parameters
$callable : mixed
$params : mixed = null
Tags
throws
Exception

with()

With a 1:many relationship (eager-loading)

public static with(mixed $name[, array<string|int, mixed>|null $options = null ]) : static
Parameters
$name : mixed
$options : array<string|int, mixed>|null = null
Return values
static

        
On this page

Search results