Documentation

Trace
in package
uses DatabaseTrait

Table of Contents

Properties

$error_message  : string
$boundaryPartOf  : int|null
$boundaryTypeIds  : array<string|int, mixed>|null
$current_depth  : int
$current_recursions  : int
$direction  : string
$materialIds  : array<string|int, int>|null
$max_depth  : int
$max_recursions  : int
$storedResults  : array<string|int, mixed>
$traceStack  : array<string|int, LedgerEntry>

Methods

__construct()  : mixed
configErrorMessage()  : string
Returns the configuration error message.
getConfig()  : TiqConfig
Gets the TIQ configuration.
getDb()  : PgSQL
Gets database instance.
isDebug()  : bool
Is debug mode or not.
run()  : array<string|int, mixed>
Takes a LedgerEntry and traces its sources or destinations based on a variety of inputs.
checkEntry()  : bool
returns true if a boundary is found
checkOverload()  : bool
returns true if recursion step or depth is greater than limit

Properties

$error_message

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

$boundaryPartOf

protected int|null $boundaryPartOf

id of the node of which movements' accounts must be part of. This is a physical barrier like an area, place, organization that will be an instance in the model

$boundaryTypeIds

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

id's of the types of which the trace should end. E.g., the type of 'Receiving Dock' or 'Load Out Bay' will stop the trace once a movement is detected into one of these

$current_depth

protected int $current_depth = 0

the current depth of the trace

$current_recursions

protected int $current_recursions = 0

the current depth of the trace. This value will grow as we go deeper

$direction

protected string $direction

either 'upstream' or 'downstream'

$materialIds

protected array<string|int, int>|null $materialIds = []

id's of the materials of which the trace should end. E.g., starting from a 'Roll of Steel' trace until I reach movements of type 'Engine Chassis'

$max_depth

protected int $max_depth = 50

max depth of the trace

$max_recursions

protected int $max_recursions = 5000

protects against out of control traces. TODO: This should be a setting in the backend UI.

$storedResults

protected array<string|int, mixed> $storedResults = ['accounts' => [], 'movements' => []]

$traceStack

protected array<string|int, LedgerEntry> $traceStack = []

that contains the result of a trace

Methods

__construct()

public __construct(string $direction[, int|null $boundaryPartOf = null ][, array<string|int, mixed>|null $boundaryTypeIds = [] ][, array<string|int, mixed>|null $materialIds = [] ][, int $max_depth = 1000 ]) : mixed
Parameters
$direction : string
$boundaryPartOf : int|null = null
$boundaryTypeIds : array<string|int, mixed>|null = []
$materialIds : array<string|int, mixed>|null = []
$max_depth : int = 1000

configErrorMessage()

Returns the configuration error message.

public static configErrorMessage() : string
Return values
string

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

isDebug()

Is debug mode or not.

public static isDebug() : bool
Return values
bool

run()

Takes a LedgerEntry and traces its sources or destinations based on a variety of inputs.

public run(LedgerEntry $entry) : array<string|int, mixed>
Parameters
$entry : LedgerEntry
Tags
throws
Exception
Return values
array<string|int, mixed>

of LedgerEntries that will be the sources or destinations of the full trace depending on the direction

checkEntry()

returns true if a boundary is found

protected checkEntry(LedgerEntry $entry) : bool
Parameters
$entry : LedgerEntry
Return values
bool

checkOverload()

returns true if recursion step or depth is greater than limit

protected checkOverload() : bool
Return values
bool

        
On this page

Search results