Documentation

SpitexMapper extends AbstractMapper
in package

The AbstractMapper is used to retrieve and store DomainObjects from and to the Database

A DataMapper implementation has to provide the methods for interaction
But There should be find[ByXYZ] methods to retreive the respective DomainObject and insert/update methods to store the data to the Database

Table of Contents

Constants

COLUMNS  = [self::TABLE => ['id', 'logo', 'name', 'zusatz', 'gln', 'str', 'plz', 'billcare', 'mod_ekarus', 'mod_xml', 'mod_pop', 'mod_qr', 'mod_dienstplan', 'mod_tourenplan']]
An array of all the database columns to build the query from.
JOINS  = []
An array of database joins to build the query from.
ORDERCOLUMNS  = []
An array of default order columns.
TABLE  = 'spitex'
The name of the database table to build the query from.
WHERE  = []
An array of default where clauses concatenated by AND.

Properties

$dbc  : mysqli
$fieldMap  : array<string|int, mixed>
$map  : array<string|int, mixed>

Methods

__construct()  : mixed
delete()  : mixed
doLoad()  : Spitex
find()  : Spitex|null
Finds rows in Spitex table and returns the first one or null if no rows in table
findAll()  : Iterator
Returns all DomainObjects of that type
findMany()  : DomainObjectCollection
findOne()  : DomainObject
insert()  : mixed
load()  : DomainObject
loadGhost()  : void
map()  : array<string|int, mixed>
mapValues()  : mixed
Map DomainObjectValues to database column values
sqlOrderBy()  : string
sqlWhere()  : mixed
store()  : mixed
storeMany()  : mixed
update()  : mixed
updateAll()  : mixed
abstractCreateGhost()  : DomainObject
abstractFind()  : DomainObject
Executes an sql select statement
createGhost()  : Spitex
customQuery()  : IQuery
insertQuery()  : IQuery
Returns a new INSERT Query Instance
query()  : IQuery
Returns a new SELECT Query Instance.
sqlColumns()  : string
sqlDeleteQuery()  : string
sqlInsertQuery()  : string
sqlJoins()  : string
sqlSelectQuery()  : string
sqlUpdateQuery()  : string
updateQuery()  : IQuery
Returns a new UPDATE Query Instance

Constants

COLUMNS

An array of all the database columns to build the query from.

public array<string|int, mixed> COLUMNS = [self::TABLE => ['id', 'logo', 'name', 'zusatz', 'gln', 'str', 'plz', 'billcare', 'mod_ekarus', 'mod_xml', 'mod_pop', 'mod_qr', 'mod_dienstplan', 'mod_tourenplan']]

needs to be overwritten in the concrete implementations

self::TABLE => [col1, col2, ...]

JOINS

An array of database joins to build the query from.

public array<string|int, joinIndex> JOINS = []

can be overwritten in the concrete implementations

=> [<joinType>, , <joinCondition>, [col1, col2, ...]]

ORDERCOLUMNS

An array of default order columns.

public array<string|int, mixed> ORDERCOLUMNS = []

can be overwritten in the concrete implementations

TABLE

The name of the database table to build the query from.

public string TABLE = 'spitex'

needs to be overwritten in the concrete implementations

WHERE

An array of default where clauses concatenated by AND.

public array<string|int, mixed> WHERE = []

can be overwritten in the concrete implementations

[condition1, condition2, ...]

Properties

$fieldMap

protected array<string|int, mixed> $fieldMap = ['id' => 'id', 'logo' => 'logo', 'name' => 'name', 'gln' => 'gln', 'billcare' => 'billcare', 'ekarusModule' => 'mod_ekarus', 'xmlModule' => 'mod_xml', 'popModule' => 'mod_pop', 'qrModule' => 'mod_qr', 'dpModule' => 'mod_dienstplan', 'tpModule' => 'mod_tourenplan']

Map DomainObjects field names to database column names

$map

protected static array<string|int, mixed> $map

Identity Map of DomainObjects

Methods

__construct()

public __construct(mysqli $dbc) : mixed
Parameters
$dbc : mysqli

The database Connection Object

find()

Finds rows in Spitex table and returns the first one or null if no rows in table

public find() : Spitex|null
Return values
Spitex|null

findAll()

Returns all DomainObjects of that type

public findAll() : Iterator
Return values
Iterator

mapValues()

Map DomainObjectValues to database column values

public mapValues(array<string|int, mixed> $values[, bool $escape = true ]) : mixed
Parameters
$values : array<string|int, mixed>

array of [fieldName => value] pairs

$escape : bool = true

If set to false the mapped value will not be mysql_real_escaped

sqlOrderBy()

public sqlOrderBy(array<string|int, mixed> $orderColumns) : string
Parameters
$orderColumns : array<string|int, mixed>
Return values
string

sqlWhere()

public sqlWhere(array<string|int, mixed> $where) : mixed
Parameters
$where : array<string|int, mixed>

storeMany()

public storeMany(mixed $dmos) : mixed
Parameters
$dmos : mixed

abstractFind()

Executes an sql select statement

protected abstractFind(string|Varchar|int $id, IQuery $query) : DomainObject

checks if object is already in the identity map and returns it, if not it executes the sql.

Parameters
$id : string|Varchar|int

The Primary Key

$query : IQuery
Tags
throws
OutOfRangeException

If the $id is not found in the database

Return values
DomainObject

customQuery()

protected customQuery() : IQuery

check why this would be needed, we can override query() for different queries

Return values
IQuery

query()

Returns a new SELECT Query Instance.

protected query() : IQuery

Can be overwritten to return different implementations of IQuery

Return values
IQuery

sqlColumns()

protected sqlColumns(array<string|int, mixed> $tableColumns) : string
Parameters
$tableColumns : array<string|int, mixed>

[$table => [ $column, ... ], ...]

Return values
string

sqlDeleteQuery()

protected sqlDeleteQuery(string $table, string $where) : string
Parameters
$table : string
$where : string

condition

Return values
string

sqlInsertQuery()

protected sqlInsertQuery(array<string|int, mixed> $values, string $table) : string
Parameters
$values : array<string|int, mixed>

[$field => $value, ...]

$table : string
Return values
string

sqlJoins()

protected sqlJoins(array<string|int, mixed> $joins) : string
Parameters
$joins : array<string|int, mixed>
Return values
string

sqlSelectQuery()

protected sqlSelectQuery(array<string|int, mixed> $columns, string $table, array<string|int, mixed> $joins, array<string|int, mixed> $where, array<string|int, mixed> $orderColumns) : string
Parameters
$columns : array<string|int, mixed>

[$table => [ $column, ... ], ...]

$table : string
$joins : array<string|int, mixed>

array of sql joins

$where : array<string|int, mixed>

array of where clauses joined with AND

$orderColumns : array<string|int, mixed>

array of order clauses joined with ,

Return values
string

sqlUpdateQuery()

protected sqlUpdateQuery(array<string|int, mixed> $values, string $table, string $where) : string
Parameters
$values : array<string|int, mixed>
$table : string
$where : string

condition

Return values
string

        
On this page

Search results