BaseDBAL
extends Doctrine
in package
implements
DBAL
Define database abstraction layer for chats
Define the interface to handle stored vouchers in the database. We use the doctrine interface as base definition
Tags
Interfaces, Classes, Traits and Enums
- DBAL
- Define Database abstraction layer This is the dba handler interface definition
Table of Contents
- $FIELD_EXTERNAL_ID : string
- $FIELD_ID : string
- $table : string
- Placeholder for table field
- $charset : string
- $interface : null|bool|Connection
- The search interface
- AddDocument() : Result
- Add a document
- DeleteDocument() : Result
- DeleteDocumentList() : Result
- Delete a document list
- DirectQuery() : Result
- Direct execute query
- Drop() : Result
- Delete a document
- Execute() : Result
- Fetch() : Result
- Get a document Get a document from database index.
- GetClient() : Connection|null
- GetServerVersion() : string|null
- GetVersion() : string
- IndexList() : Result
- Update() : Result
- Update a document
- Write() : Result
- Add/update a document
- __construct() : mixed
- Create with individual table
- AddSingle() : Result
- client() : null|Connection
- Setup client
- DropSingle() : Result
- FetchSingle() : Result
- setupFilters() : void
Properties
$FIELD_EXTERNAL_ID
public
static string
$FIELD_EXTERNAL_ID
= 'external_id'
$FIELD_ID
public
static string
$FIELD_ID
= 'id'
$table
Placeholder for table field
protected
string
$table
= ''
$charset
private
string
$charset
= 'utf8mb4'
The charset for the connection
$interface
The search interface
private
null|bool|Connection
$interface
= null
A client instance
Methods
AddDocument()
Add a document
public
AddDocument(int|string|null $id, string|null $type, mixed $data[, bool $has_auto_increment = false ][, string|null $table = null ]) : Result
Add a document to search index.
Parameters
- $id : int|string|null
-
A object id
- $type : string|null
-
The type of object, in our case the primary column
- $data : mixed
-
The document data with key value pairs
- $has_auto_increment : bool = false
-
Known table with auto increment column
- $table : string|null = null
Return values
Result —A system result object
DeleteDocument()
public
DeleteDocument(int|string|array<string|int, mixed> $id, string $type) : Result
Parameters
- $id : int|string|array<string|int, mixed>
- $type : string
Tags
Return values
Result —DeleteDocumentList()
Delete a document list
public
DeleteDocumentList(string|null $type) : Result
Delete a document list from search index. When no type is given then delete the hole index
Parameters
- $type : string|null
-
The type of object
Return values
Result —A system result object
DirectQuery()
Direct execute query
public
DirectQuery(string $sql) : Result
Execute a given query, use with care and commit using external arguments
Parameters
- $sql : string
-
The query to execute
Return values
Result —A system result object
Drop()
Delete a document
public
Drop(int|string $id) : Result
Parameters
- $id : int|string
-
A object id
Tags
Return values
Result —A system result object
Execute()
public
Execute(array<string|int, mixed> $filter, array<string|int, mixed> $order, array<string|int, mixed> $payload, string|null $language, null|object $handler) : Result
Parameters
- $filter : array<string|int, mixed>
- $order : array<string|int, mixed>
- $payload : array<string|int, mixed>
- $language : string|null
- $handler : null|object
Tags
Return values
Result —Fetch()
Get a document Get a document from database index.
public
Fetch(int|string $id) : Result
Parameters
- $id : int|string
-
A object id
Return values
Result —A system result object
GetClient()
public
GetClient() : Connection|null
Return values
Connection|null —GetServerVersion()
public
GetServerVersion() : string|null
Tags
Return values
string|null —GetVersion()
public
GetVersion() : string
Tags
Return values
string —IndexList()
public
IndexList(string $type, array<string|int, mixed> $list[, bool $is_full = false ][, int|string|object $correct_count = -1 ]) : Result
Parameters
- $type : string
- $list : array<string|int, mixed>
- $is_full : bool = false
- $correct_count : int|string|object = -1
Tags
Return values
Result —Update()
Update a document
public
Update(array<string|int, mixed> $condition, array<string|int, mixed> $data[, string|null $table = null ]) : Result
Update a document in search index, without check for existing.
Parameters
- $condition : array<string|int, mixed>
- $data : array<string|int, mixed>
-
The document data with key value pairs
- $table : string|null = null
Return values
Result —A system result object
Write()
Add/update a document
public
Write(int|string|null $id, array<string|int, mixed> $data) : Result
Add/update a document to search index.
Parameters
- $id : int|string|null
-
A object id or, null for new entries
- $data : array<string|int, mixed>
-
The document data with key value pairs
Return values
Result —A system result object
__construct()
Create with individual table
protected
__construct(string $table) : mixed
VoucherDBAL constructor.
Parameters
- $table : string
Return values
mixed —AddSingle()
protected
AddSingle(array<string|int, mixed> $cells, string $pk, string $table) : Result
Parameters
- $cells : array<string|int, mixed>
- $pk : string
- $table : string
Return values
Result —client()
Setup client
protected
client() : null|Connection
Connect to local database server and return instance. This method is cached
Return values
null|Connection —DropSingle()
protected
DropSingle(int|string $id, string $pk, string $table) : Result
Parameters
- $id : int|string
- $pk : string
- $table : string
Return values
Result —FetchSingle()
protected
FetchSingle(int|string $id, string $pk, string $table) : Result
Parameters
- $id : int|string
- $pk : string
- $table : string
Return values
Result —setupFilters()
private
setupFilters(array<string|int, Filter> $filters, QueryBuilder &$queryBuilder, QueryBuilder &$queryBuilderCount) : void
Parameters
- $filters : array<string|int, Filter>
-
A set of filters
- $queryBuilder : QueryBuilder
-
A doctrine query builder for search
- $queryBuilderCount : QueryBuilder
-
A doctrine query builder for count