Documentation

InvoiceMapper 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', 'id_klient', 'id_vers', 'id_arzt', 'id_owner', 'id_organisation', 'id_kanton', 'gesamt_min', 'gesamt_taxp', 'r_betrag', 'diff', 'tp_wert', 'monat', 'jahr', 'von_monat', 'von_jahr', 'geschickt', 'geld_erhalten', 'rech_datum', 'schreiben', 'vers_nr', 'grund', 'status', 'berechnung', 'gesetz', 'material', 'preis_material', 'preis_ft', 'ea_erstellt', 'spitex', 'abrech_kv', 'exportiert', 'exportiert_cag', 'exportiert_ceesv', 'exportiert_billcare', 'exportiert_abacus', 'rkosten_anzeigen', 'geschlossen', 'covid19']]
An array of all the database columns to build the query from.
ORDERCOLUMNS  = []
An array of default order columns.
TABLE  = 'rechnung'
The name of the database table to build the query from.
WHERE  = ['rechnung.del=0']
An array of default where clauses concatenated by AND.
JOINS  = ['rechnung_ea' => ['INNER JOIN', 'rechnung_ea', 'rechnung.id=rechnung_ea.id_rech', ['anteil_ea', 'anteil_gemeinde', 'anteil_kanton']], 'client' => ['INNER JOIN', \VeruA\DataMapper\ClientMapper::TABLE, 'rechnung.id_klient=`client`.id', \VeruA\DataMapper\ClientMapper::COLUMNS[\VeruA\DataMapper\ClientMapper::TABLE]], 'client.person' => ['INNER JOIN', \VeruA\DataMapper\PersonMapper::TABLE, 'id_pers=`client.person`.id', \VeruA\DataMapper\PersonMapper::COLUMNS[\VeruA\DataMapper\PersonMapper::TABLE]], 'client.person.address' => ['INNER JOIN', \VeruA\DataMapper\AddressMapper::TABLE, '`client.person`.id_adr=`client.person.address`.id', \VeruA\DataMapper\AddressMapper::COLUMNS[\VeruA\DataMapper\AddressMapper::TABLE]], 'insurance' => ['INNER JOIN', \VeruA\DataMapper\OrganisationMapper::TABLE, '`insurance`.id=rechnung.id_vers', \VeruA\DataMapper\OrganisationMapper::COLUMNS[\VeruA\DataMapper\OrganisationMapper::TABLE]]]
An array of database joins to build the query from.

Properties

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

Methods

__construct()  : mixed
delete()  : mixed
find()  : mixed
get Invoice by id like 'KV_123' or 'KT_456'
findAll()  : Iterator
Returns all DomainObjects of that type
findByReceiver()  : mixed
findMany()  : DomainObjectCollection
findOne()  : DomainObject
findOutstanding()  : DomainObjectCollection
Returns all open invoices for a given owner
insert()  : mixed
invoiceQuery()  : mixed
load()  : DomainObject
loadGhost()  : void
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()  : DomainObject
customQuery()  : IQuery
doLoad()  : Invoice
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', 'id_klient', 'id_vers', 'id_arzt', 'id_owner', 'id_organisation', 'id_kanton', 'gesamt_min', 'gesamt_taxp', 'r_betrag', 'diff', 'tp_wert', 'monat', 'jahr', 'von_monat', 'von_jahr', 'geschickt', 'geld_erhalten', 'rech_datum', 'schreiben', 'vers_nr', 'grund', 'status', 'berechnung', 'gesetz', 'material', 'preis_material', 'preis_ft', 'ea_erstellt', 'spitex', 'abrech_kv', 'exportiert', 'exportiert_cag', 'exportiert_ceesv', 'exportiert_billcare', 'exportiert_abacus', 'rkosten_anzeigen', 'geschlossen', 'covid19']]

needs to be overwritten in the concrete implementations

self::TABLE => [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 = 'rechnung'

needs to be overwritten in the concrete implementations

WHERE

An array of default where clauses concatenated by AND.

public array<string|int, mixed> WHERE = ['rechnung.del=0']

can be overwritten in the concrete implementations

[condition1, condition2, ...]

JOINS

An array of database joins to build the query from.

protected array<string|int, joinIndex> JOINS = ['rechnung_ea' => ['INNER JOIN', 'rechnung_ea', 'rechnung.id=rechnung_ea.id_rech', ['anteil_ea', 'anteil_gemeinde', 'anteil_kanton']], 'client' => ['INNER JOIN', \VeruA\DataMapper\ClientMapper::TABLE, 'rechnung.id_klient=`client`.id', \VeruA\DataMapper\ClientMapper::COLUMNS[\VeruA\DataMapper\ClientMapper::TABLE]], 'client.person' => ['INNER JOIN', \VeruA\DataMapper\PersonMapper::TABLE, 'id_pers=`client.person`.id', \VeruA\DataMapper\PersonMapper::COLUMNS[\VeruA\DataMapper\PersonMapper::TABLE]], 'client.person.address' => ['INNER JOIN', \VeruA\DataMapper\AddressMapper::TABLE, '`client.person`.id_adr=`client.person.address`.id', \VeruA\DataMapper\AddressMapper::COLUMNS[\VeruA\DataMapper\AddressMapper::TABLE]], 'insurance' => ['INNER JOIN', \VeruA\DataMapper\OrganisationMapper::TABLE, '`insurance`.id=rechnung.id_vers', \VeruA\DataMapper\OrganisationMapper::COLUMNS[\VeruA\DataMapper\OrganisationMapper::TABLE]]]

can be overwritten in the concrete implementations

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

Properties

$fieldMap

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

Map DomainObjects field names to database column names

Tags
abstract

overwrite in concrete implementation with correct mapping

$map

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

Identity Map of Invoice Objects

Methods

__construct()

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

The database Connection Object

find()

get Invoice by id like 'KV_123' or 'KT_456'

public find(string $id) : mixed
Parameters
$id : string

findAll()

Returns all DomainObjects of that type

public findAll() : Iterator
Return values
Iterator

findByReceiver()

public findByReceiver(mixed $id[, string $receiver = 'KV' ]) : mixed
Parameters
$id : mixed
$receiver : string = 'KV'

invoiceQuery()

public invoiceQuery(string $receiver[, array<string|int, mixed>|null $joinedTables = null ]) : mixed
Parameters
$receiver : string
$joinedTables : array<string|int, mixed>|null = null

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