Documentation

Transaction
in package
implements JsonSerializable uses DatabaseTrait, ActiveRecordTrait

Transactions are used to bind LedgerEntries together and form a movement from one account into another.

Transactions can be made up of 2 or more LedgerEntries

Table of Contents

Interfaces

JsonSerializable

Properties

$downStreamLedgerEntries  : array<string|int, mixed>
$error_message  : string
$upStreamLedgerEntries  : array<string|int, mixed>
$allowed_props  : array<string|int, mixed>
$id  : int|null
$ledger_entries  : array<string|int, mixed>
$operating_table  : string
$prop_types  : array<string|int, mixed>
$schema  : string
$unsaved_props  : array<string|int, mixed>

Methods

__construct()  : mixed
__get()  : mixed
If the property is an attribute, then return the attribute object.
__set()  : void
Set a property for this node, the value will not be saved until the 'save' method is called.
configErrorMessage()  : string
Returns the configuration error message.
createTransaction()  : Transaction
generateRelativeName()  : string
Gets the `generate_relative_name_from_display_name`.
getAllowedProps()  : array<string|int, mixed>
Get the allowed properties for this Node Return an array intersection of the Class Properties and Table Columns.
getConfig()  : TiqConfig
Gets the TIQ configuration.
getDb()  : PgSQL
Gets database instance.
getLedgerEntries()  : array<string|int, mixed>
isDebug()  : bool
Is debug mode or not.
jsonSerialize()  : array<string|int, mixed>
Typically used to create a structure that js can turn into an object in the browser minus the DatabaseTrait properties.
JSONSerializeRecord()  : array<string|int, mixed>
Returns an array that can can easily be json_encoded
save()  : void
writes updated properties into the database, or creates it if it does not exist.
setProps()  : void
Loads all database columns as static variables. To load a variable, it must exist in the class.

Properties

$downStreamLedgerEntries

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

$error_message

public static string $error_message = 'An issue occurred, please contact ThinkIQ for Support and enable debugging'
  • Base error message

$upStreamLedgerEntries

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

$allowed_props

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

$ledger_entries

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

$operating_table

protected string $operating_table = 'transactions'

$schema

protected string $schema = 'material_ledger'

Methods

__construct()

public __construct([string|int|null $identifier = null ][, array<string|int, mixed> $config = [] ][, array<string|int, mixed> $additionalMethods = [] ]) : mixed
Parameters
$identifier : string|int|null = null
  • FQN or ID
$config : array<string|int, mixed> = []
  • This array contains the same properties as a record from the corresponding table in the database
$additionalMethods : array<string|int, mixed> = []
  • Methods to be call we initiate the class.
Tags
throws
Exception

__get()

If the property is an attribute, then return the attribute object.

public __get(mixed $name) : mixed
Parameters
$name : mixed
  • The name of the attribute we want to get.

__set()

Set a property for this node, the value will not be saved until the 'save' method is called.

public __set(string $prop, mixed $value) : void
Parameters
$prop : string
  • The property we want to set.
$value : mixed
  • The value we want to set into the property.

configErrorMessage()

Returns the configuration error message.

public static configErrorMessage() : string
Return values
string

createTransaction()

public static createTransaction([string $created_by = '' ][, string $details = '' ]) : Transaction
Parameters
$created_by : string = ''
$details : string = ''
Tags
throws
Exception
Return values
Transaction

generateRelativeName()

Gets the `generate_relative_name_from_display_name`.

public static generateRelativeName(string $displayName[, string|null $typeName = null ][, int|null $partOfId = null ][, int|null $nodeId = null ]) : string
Parameters
$displayName : string
  • The display name we are searching.
$typeName : string|null = null
  • The type name we are searching.
$partOfId : int|null = null
  • The part of ID we are searching.
$nodeId : int|null = null
  • The Node ID that we are searching.
Return values
string

getAllowedProps()

Get the allowed properties for this Node Return an array intersection of the Class Properties and Table Columns.

public getAllowedProps() : array<string|int, mixed>
Return values
array<string|int, mixed>

getConfig()

Gets the TIQ configuration.

public static getConfig() : TiqConfig
Return values
TiqConfig

getDb()

Gets database instance.

public static getDb() : PgSQL

The database connection is stored in a static property within the DatabaseConnectionManager class, ensuring that it is truly a singleton across the entire application, regardless of which class calls this method.

Return values
PgSQL

getLedgerEntries()

public getLedgerEntries([array<string|int, mixed> $additionalMethods = [] ]) : array<string|int, mixed>
Parameters
$additionalMethods : array<string|int, mixed> = []
Tags
throws
Exception
Return values
array<string|int, mixed>

isDebug()

Is debug mode or not.

public static isDebug() : bool
Return values
bool

jsonSerialize()

Typically used to create a structure that js can turn into an object in the browser minus the DatabaseTrait properties.

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

JSONSerializeRecord()

Returns an array that can can easily be json_encoded

public JSONSerializeRecord() : array<string|int, mixed>
Return values
array<string|int, mixed>

save()

writes updated properties into the database, or creates it if it does not exist.

public save() : void
Tags
throws
PDOException
throws
Exception

setProps()

Loads all database columns as static variables. To load a variable, it must exist in the class.

protected setProps([array<string|int, mixed> $config = [] ][, array<string|int, mixed> $additionalMethods = [] ]) : void

If the 'id' property is not set, we still run this function, populating the $allowed_props variable.

Parameters
$config : array<string|int, mixed> = []
  • This array contains the same properties as a record from the corresponding table in the database.
$additionalMethods : array<string|int, mixed> = []
  • Methods to be call to call when we initiate the class.

        
On this page

Search results