Encoded
extends Record
in package
Encoded record class
Tags
Table of Contents
Properties
- $base64Fields : array<string|int, mixed>
- Base64-encoded fields
- $cipherMethod : string|null
- Cipher method
- $encryptedFields : array<string|int, mixed>
- Encrypted fields
- $hashAlgorithm : string
- Hash algorithm
- $hashFields : array<string|int, mixed>
- Password-hashed fields
- $hashOptions : array<string|int, mixed>
- Hash options
- $isNew : bool
- Is new record flag
- $isTransaction : bool
- Is transaction flag
- $iv : string|null
- Encrypted field IV (base64-encoded)
- $jsonFields : array<string|int, mixed>
- JSON-encoded fields
- $key : string|null
- Encrypted field key
- $phpFields : array<string|int, mixed>
- PHP-serialized fields
- $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)
- decode() : array<string|int, mixed>
- Scrub the column values and decode them
- decodeValue() : mixed
- Decode value
- decrement() : void
- Decrement the record column and save
- delete() : void
- Delete the record
- encode() : array<string|int, mixed>
- Scrub the column values and encode them
- encodeValue() : string
- Encode value
- 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
- isEncodedColumn() : bool
- Determine if column is an encoded column
- 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() : Encoded
- 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
- verify() : bool
- Verify value against hash
- with() : static
- With a 1:many relationship (eager-loading)
Properties
$base64Fields
Base64-encoded fields
protected
array<string|int, mixed>
$base64Fields
= []
$cipherMethod
Cipher method
protected
string|null
$cipherMethod
= null
$encryptedFields
Encrypted fields
protected
array<string|int, mixed>
$encryptedFields
= []
$hashAlgorithm
Hash algorithm
protected
string
$hashAlgorithm
= PASSWORD_BCRYPT
$hashFields
Password-hashed fields
protected
array<string|int, mixed>
$hashFields
= []
$hashOptions
Hash options
protected
array<string|int, mixed>
$hashOptions
= ['cost' => 10]
$isNew
Is new record flag
protected
bool
$isNew
= false
$isTransaction
Is transaction flag
protected
bool
$isTransaction
= false
$iv
Encrypted field IV (base64-encoded)
protected
string|null
$iv
= null
$jsonFields
JSON-encoded fields
protected
array<string|int, mixed>
$jsonFields
= []
$key
Encrypted field key
protected
string|null
$key
= null
$phpFields
PHP-serialized fields
protected
array<string|int, mixed>
$phpFields
= []
$prefix
Table prefix
protected
string|null
$prefix
= null
$primaryKeys
Primary keys
protected
array<string|int, mixed>
$primaryKeys
= ['id']
$relationships
Relationships
protected
array<string|int, mixed>
$relationships
= []
$rowGateway
Row gateway
protected
Row|null
$rowGateway
= null
$table
Table name
protected
string|null
$table
= null
$tableGateway
Table gateway
protected
Table|null
$tableGateway
= null
$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
__get()
Magic method to return the value of $this->rowGateway[$name]
public
__get(string $name) : mixed
Parameters
- $name : string
Tags
__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
Tags
__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
AbstractRecordbelongsTo()
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|BelongsTocommit()
Commit transaction with the DB adapter
public
static commit() : void
Tags
commitTransaction()
Commit transaction
public
commitTransaction() : AbstractRecord
Tags
Return values
AbstractRecordcopy()
Copy the record (alias to replicate)
public
copy([array<string|int, mixed> $replace = [] ]) : static
Parameters
- $replace : array<string|int, mixed> = []
Return values
staticcount()
Method to get count of fields in row gateway
public
count() : int
Return values
intcountRows()
Get the count of rows returned in the result
public
countRows() : int
Return values
intdb()
Get DB adapter (alias)
public
static db() : AbstractAdapter
Return values
AbstractAdapterdecode()
Scrub the column values and decode them
public
decode(array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>decodeValue()
Decode value
public
decodeValue(string $key, string $value) : mixed
Parameters
- $key : string
- $value : string
Tags
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
encode()
Scrub the column values and encode them
public
encode(array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>encodeValue()
Encode value
public
encodeValue(string $key, mixed $value) : string
Parameters
- $key : string
- $value : mixed
Tags
Return values
stringexecute()
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>|intfindAll()
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>|staticfindBy()
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>getDb()
Get DB adapter
public
static getDb() : AbstractAdapter
Return values
AbstractAdaptergetDirty()
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
stringgetIn()
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
ArrayIteratorgetOne()
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|nullgetPrimaryKeys()
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>getRowGateway()
Get the row gateway
public
getRowGateway() : Row|null
Return values
Row|nullgetRows()
Get the rows
public
getRows() : Collection
Return values
CollectiongetSql()
Get SQL builder
public
static getSql() : Sql
Return values
SqlgetTable()
Get the table
public
getTable() : string|null
Return values
string|nullgetTableGateway()
Get the table gateway
public
getTableGateway() : Table|null
Return values
Table|nullgetTableInfo()
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
intgetWithRelationships()
Get with relationships
public
getWithRelationships([bool $eager = true ]) : AbstractRecord
Parameters
- $eager : bool = true
Return values
AbstractRecordgetWiths()
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
boolhasMany()
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|HasManyhasOne()
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|HasOnehasOneOf()
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|HasOneOfhasRelationship()
Has relationship
public
hasRelationship(string $name) : bool
Parameters
- $name : string
Return values
boolhasRelationships()
Get relationships
public
hasRelationships() : bool
Return values
boolhasRows()
Determine if the result has rows
public
hasRows() : bool
Return values
boolhasWith()
Determine if there is specific with relationship
public
hasWith(string $name) : bool
Parameters
- $name : string
Return values
boolhasWiths()
Determine if there are with relationships
public
hasWiths() : bool
Return values
boolincrement()
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
boolisEncodedColumn()
Determine if column is an encoded column
public
isEncodedColumn(string $key) : bool
Parameters
- $key : string
Return values
boolisTransaction()
Is transaction
public
isTransaction() : bool
Return values
booloffsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
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
AbstractRecordquery()
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>|intreplicate()
Replicate the record
public
replicate([array<string|int, mixed> $replace = [] ]) : static
Parameters
- $replace : array<string|int, mixed> = []
Return values
staticresetDirty()
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
Return values
Exception|nullrollbackTransaction()
Rollback transaction
public
rollbackTransaction() : AbstractRecord
Tags
Return values
AbstractRecordrows()
Get the rows (alias method)
public
rows() : Collection
Return values
Collectionsave()
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
setColumns()
Set all the table column values at once
public
setColumns([mixed $columns = null ]) : Encoded
Parameters
- $columns : mixed = null
Tags
Return values
EncodedsetDb()
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
setDefaultDb()
Set DB adapter
public
static setDefaultDb(AbstractAdapter $db) : void
Parameters
- $db : AbstractAdapter
setPrefix()
Set the table prefix
public
setPrefix(string $prefix) : AbstractRecord
Parameters
- $prefix : string
Return values
AbstractRecordsetPrimaryKeys()
Set the primary keys
public
setPrimaryKeys(array<string|int, mixed> $keys) : AbstractRecord
Parameters
- $keys : array<string|int, mixed>
Return values
AbstractRecordsetRelationship()
Set relationship
public
setRelationship(string $name, mixed $relationship) : AbstractRecord
Parameters
- $name : string
- $relationship : mixed
Return values
AbstractRecordsetRows()
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
AbstractRecordsetTable()
Set the table
public
setTable(string $table) : AbstractRecord
Parameters
- $table : string
Return values
AbstractRecordsetTableFromClassName()
Set the table from a class name
public
setTableFromClassName([string|null $class = null ]) : AbstractRecord
Parameters
- $class : string|null = null
Return values
AbstractRecordsql()
Get SQL builder (alias)
public
static sql() : Sql
Return values
Sqlstart()
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
Return values
static|nullstartTransaction()
Start transaction
public
startTransaction() : AbstractRecord
Return values
AbstractRecordtable()
Get table name
public
static table([bool $quotes = false ]) : string
Parameters
- $quotes : bool = false
Return values
stringtoArray()
Get column values as array
public
toArray() : array<string|int, mixed>
Tags
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
verify()
Verify value against hash
public
verify(string $key, string $value) : bool
Parameters
- $key : string
- $value : string
Return values
boolwith()
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