class Context

Database context.

Traits

Strict class for better experience.

Methods

__construct(Connection $connection, IStructure $structure, IConventions $conventions = null, IStorage $cacheStorage = null)

No description

void
beginTransaction()

No description

void
commit()

No description

void
rollBack()

No description

string
getInsertId(string $sequence = null)

No description

query(string $sql, ...$params)

Generates and executes SQL query.

queryArgs(string $sql, array $params)

No description

table(string $table)

No description

getConnection()

No description

getStructure()

No description

getConventions()

No description

Row|null
fetch(string $sql, ...$params)

Shortcut for query()->fetch()

mixed
fetchField(string $sql, ...$params)

Shortcut for query()->fetchField()

array|null
fetchFields(string $sql, ...$params)

Shortcut for query()->fetchFields()

array
fetchPairs(string $sql, ...$params)

Shortcut for query()->fetchPairs()

array
fetchAll(string $sql, ...$params)

Shortcut for query()->fetchAll()

static SqlLiteral
literal(string $value, ...$params)

No description

Details

at line 36
__construct(Connection $connection, IStructure $structure, IConventions $conventions = null, IStorage $cacheStorage = null)

Parameters

Connection $connection
IStructure $structure
IConventions $conventions
IStorage $cacheStorage

at line 45
void beginTransaction()

Return Value

void

at line 51
void commit()

Return Value

void

at line 57
void rollBack()

Return Value

void

at line 63
string getInsertId(string $sequence = null)

Parameters

string $sequence

Return Value

string

at line 72
ResultSet query(string $sql, ...$params)

Generates and executes SQL query.

Parameters

string $sql
...$params

Return Value

ResultSet

at line 78
ResultSet queryArgs(string $sql, array $params)

Parameters

string $sql
array $params

Return Value

ResultSet

at line 84
Selection table(string $table)

Parameters

string $table

Return Value

Selection

at line 90
Connection getConnection()

Return Value

Connection

at line 96
IStructure getStructure()

Return Value

IStructure

at line 102
IConventions getConventions()

Return Value

IConventions

at line 114
Row|null fetch(string $sql, ...$params)

Shortcut for query()->fetch()

Parameters

string $sql
...$params

Return Value

Row|null

at line 124
mixed fetchField(string $sql, ...$params)

Shortcut for query()->fetchField()

Parameters

string $sql
...$params

Return Value

mixed

at line 133
array|null fetchFields(string $sql, ...$params)

Shortcut for query()->fetchFields()

Parameters

string $sql
...$params

Return Value

array|null

at line 142
array fetchPairs(string $sql, ...$params)

Shortcut for query()->fetchPairs()

Parameters

string $sql
...$params

Return Value

array

at line 151
array fetchAll(string $sql, ...$params)

Shortcut for query()->fetchAll()

Parameters

string $sql
...$params

Return Value

array

at line 157
static SqlLiteral literal(string $value, ...$params)

Parameters

string $value
...$params

Return Value

SqlLiteral