Account
extends Node
in package
Accounts are attached to places, areas, and equipment in the model to indicate that this is where material movements will be tracked
Tags
Table of Contents
Constants
- EDIT_STATUS = [0 => '', 1 => 'In Work', 2 => 'In Review', 3 => 'Approved', 4 => 'Done']
- EDIT_STATUS
- TABLE_TO_CLASS = ['attributes' => 'Attribute', 'attribute_types' => 'AttributeType', 'connectors' => 'Connector', 'enumeration_types' => 'EnumerationType', 'equipment' => 'Equipment', 'equipment_types' => 'EquipmentType', 'gateways' => 'Gateway', 'objects' => 'GenericObject', 'libraries' => 'Library', 'limits' => 'Limit', 'materials' => 'Material', 'measurement_units' => 'MeasurementUnit', 'opc_groups' => 'OpcGroup', 'opcua_objects' => 'OpcuaObject', 'organizations' => 'Organization', 'persons' => 'GenericObject', 'places' => 'Place', 'quantities' => 'QuantityKind', 'relationships' => 'Relationship', 'relationship_types' => 'RelationshipType', 'scripts' => 'Script', 'tags' => 'Tag', 'types' => 'Type', 'type_to_attribute_types' => 'TypeToAttributeType', 'type_to_child_types' => 'TypeToChildType']
Properties
- $account : Account|null
- $attributes : array<string|int, mixed>
- $children : array<string|int, mixed>
- $current_transaction_id : int|null
- $description : string
- $display_name : string
- $error_message : string
- $fqn : string
- $id : string
- $latest_movement : DateTimeInterface|null
- $latest_movement_reasoning : string|null
- $nodes : array<string|int, mixed>
- $open_flows : array<string|int, mixed>
- $parent : Node|null
- $relationshipsDown : array<string|int, mixed>
- $relationshipsUp : array<string|int, mixed>
- $scripts : array<string|int, mixed>
- $totalAttributes : int|null
- $totalScripts : int|null
- $access_group_ids : array<string|int, mixed>|null
- $allowed_props : array<string|int, mixed>
- $balance_attribute : Attribute|null
- $balance_attribute_id : int|null
- $balance_method : string
- $base_material_type_ids : mixed|array<string|int, mixed>|null
- $called_constructor : bool
- $class_script : Script|null
- $created_timestamp : string|null
- $display_path : string|null
- $display_scripts : array<string|int, mixed>
- $document : string|null
- $edit_status : string|null
- $empty_level : string|null
- $event_object_types : array<string|int, mixed>
- $full_level : mixed
- $id_path : string|null
- $importance : float|null
- $influence_ratio_limit : float|null
- $is_root : bool|null
- $key_attribute_nodes : array<string|int, mixed>
- $key_attributes : mixed|array<string|int, mixed>|null
- $last_movement_timestamp : string|null
- $ledger_entries : array<string|int, mixed>
- $library : Library|null
- $material_nodes : array<string|int, mixed>
- $measurement_unit_id : int|null
- $measurementUnit : MeasurementUnit|null
- $operating_table : string
- $part_of_id : int|null
- $process_start_id : int|null
- $process_start_node : Node|null
- $prop_types : array<string|int, mixed>
- $relationship : mixed|Relationship
- $relationship_id : int|null
- $relative_name : string|null
- $schema : string
- $system_node_type : SystemNodeType|null
- $system_node_type_id : int|null
- $threshold_limit : float|null
- The minimum movement amount to be considered a movement
- $type : Type|null
- $type_id : int|null
- $type_name : string|null
- $unlink_relative_name : bool|null
- $unsaved_props : array<string|int, mixed>
- $updated_timestamp : string|null
Methods
- __construct() : mixed
- Node constructor.
- __debugInfo() : array<string|int, mixed>|null
- Magic Method called by functions like var_dump and print_r. We prune the object before emitting.
- __get() : mixed
- If the property is an attribute, then return the attribute object.
- __isset() : bool
- Magic hook that methods like empty() and isset() call this method. Without this method code like: `if(empty($node->attr->max_value))` will always be empty, as the properties are protected.
- __set() : void
- Set a property for this node, the value will not be saved until the 'save' method is called.
- __toString() : string
- Called during a print/echo statement, this function returns a html table of all the attributes of the Node, minus the DatabaseTrait properties.
- closeOpenOutFlowMovements() : void
- When we close a flow, we need to create a complete movement. This means that we create a mirrored inflow to the destination which shares a new transaction id.
- configErrorMessage() : string
- Returns the configuration error message.
- delete() : void
- Delete by ID Cleans up Scripts and other dependant items.
- deleteLedgerEntries() : void
- findNodesByTypes() : array<string|int, mixed>
- Searches down the id path to find any node of the given type (display name or relative name) If depth is set, the search will only go down that many levels
- findObjectByType() : array<string|int, mixed>
- Searches each of the children and if the specify object type is not found, it goes up one level and does a recursion to search the children higher up until we don't have any more parents to search into.
- generateRelativeName() : string
- Gets the `generate_relative_name_from_display_name`.
- getAccount() : Account|null
- Gets the account information for the given Node
- getAllowedProps() : array<string|int, mixed>
- Get the allowed properties for this Node Return an array intersection of the Class Properties and Table Columns.
- getAttributeCount() : $this
- Gets the total attribute count of the given node.
- getAttributes() : $this
- Queries attributes for a given node add attaches it to the node object.
- getBalance() : float
- Gets the balance of an account at a time. If no time is passed, NOW is used. If there are no movements, 0 is returned
- getBalanceAttribute() : Attribute|null
- getChildren() : $this
- getConfig() : TiqConfig
- Gets the TIQ configuration.
- getDb() : PgSQL
- Gets database instance.
- getDisplayScripts() : Node
- Gets the Display scripts associate to this node, will search inheritance path as well as type
- getEventObjectTypes() : array<string|int, mixed>|null
- Returns an array of Types that have been used to make event objects for this account
- getFQN() : string
- Returns a human-readable FQN.
- getFQNDisplayPath() : array<string|int, mixed>|array<string|int, string>
- This is a bulk call of the function getFQN for multiple nodes.
- getInFlows() : array<string|int, mixed>
- Gets upstream flows based on an account id and time. The getOne flag is used to test if there are any upstream movements quickly
- getInstance() : Node
- Gets current instance of the Node.
- getKeyAttributes() : array<string|int, mixed>|null
- getLastMovement() : LedgerEntry|false
- Gets the latest ledgerEntry for this account
- getLedgerEntries() : array<string|int, mixed>|null
- getLibrary() : Library|null
- returns Library this node belongs to, and null for objects.
- getMaterials() : array<string|int, mixed>|null
- getMeasurementUnit() : MeasurementUnit|null
- getNodeId() : int
- Return the ID from and FQN
- getNodeSet() : array<string|int, mixed>
- Returns a list of all nodes that are for type $identifier to get the type name use "SELECT * FROM model.system_node_types".
- getOperatingTable() : string
- Returns the current operating table.
- getOrCreateAccount() : Account
- Gets the account of a node. If there is no account, create a new account with default properties and the same name as its parent.
- getOutFlows() : array<string|int, mixed>
- Gets downstream flows based on an account id and time. The getOne flag is used to test if there are any downstream movements quickly
- getParent() : $this
- This function fetches all the nodes one level up.
- getProcessStartNode() : void
- Loads the State data into the Attribute Class instance.
- getRelationshipsDown() : Node
- Gets all direct children nodes.
- getRelationshipsUp() : Node
- Gets all direct parent nodes.
- getScripts() : Node
- Gets the scripts associate to this node.
- getSystemType() : Node
- Sets the system type name of the given attribute.
- getTaxonomySystemNodeTypeId() : int
- Gets the Taxonomy System Node Type ID.
- getType() : Type|null
- sets a Type model based on the current type_id.
- hasClassScript() : bool
- Checks all the nodes' script to see if there is a class script.
- 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
- loadOpenSourceAccounts() : array<string|int, mixed>
- processSources() : void
- load previous state (open flows) intersect the new flows with open flows - create open flows that exist in new flows and not open flows create open outflows on the source account of the new flows if count(new_flows) > 0 && count(open_flows) === 0 open an inflow on the destination - close flows that exist in open flows and not new flows create movements from closed flows if count(new_flows) === 0 && count(open_flows) > 0 close the destination's side movements - do nothing if the new flow exists in the open flows
- reduceFQN() : array<string|int, string>
- Handles to reduce the FQN paths to help the UI for the client.
- save() : void
- writes updated properties into the database, or creates it if it does not exist.
- convertPostgresTypeArray() : array<string|int, mixed>
- Take a postgres typed array and converts it to a php array e.g. {"test 1","test 2"} from postgres will yield ["test 1", "test 2"]
- getTypeName() : string
- Gets the Type Name.
- setProps() : void
- Loads all database columns as static variables. To load a variable, it must exist in the class.
Constants
EDIT_STATUS
EDIT_STATUS
public
mixed
EDIT_STATUS
= [0 => '', 1 => 'In Work', 2 => 'In Review', 3 => 'Approved', 4 => 'Done']
TABLE_TO_CLASS
public
mixed
TABLE_TO_CLASS
= ['attributes' => 'Attribute', 'attribute_types' => 'AttributeType', 'connectors' => 'Connector', 'enumeration_types' => 'EnumerationType', 'equipment' => 'Equipment', 'equipment_types' => 'EquipmentType', 'gateways' => 'Gateway', 'objects' => 'GenericObject', 'libraries' => 'Library', 'limits' => 'Limit', 'materials' => 'Material', 'measurement_units' => 'MeasurementUnit', 'opc_groups' => 'OpcGroup', 'opcua_objects' => 'OpcuaObject', 'organizations' => 'Organization', 'persons' => 'GenericObject', 'places' => 'Place', 'quantities' => 'QuantityKind', 'relationships' => 'Relationship', 'relationship_types' => 'RelationshipType', 'scripts' => 'Script', 'tags' => 'Tag', 'types' => 'Type', 'type_to_attribute_types' => 'TypeToAttributeType', 'type_to_child_types' => 'TypeToChildType']
Properties
$account
public
Account|null
$account
= null
$attributes
public
array<string|int, mixed>
$attributes
= []
$children
public
array<string|int, mixed>
$children
= []
$current_transaction_id
public
int|null
$current_transaction_id
= null
$description
public
string
$description
$display_name
public
string
$display_name
$error_message
public
static string
$error_message
= 'An issue occurred, please contact ThinkIQ for Support and enable debugging'
- Base error message
$fqn
public
string
$fqn
$id
public
string
$id
$latest_movement
public
DateTimeInterface|null
$latest_movement
= null
$latest_movement_reasoning
public
string|null
$latest_movement_reasoning
= null
$nodes
public
array<string|int, mixed>
$nodes
= []
$open_flows
public
array<string|int, mixed>
$open_flows
= []
$parent
public
Node|null
$parent
= null
$relationshipsDown
public
array<string|int, mixed>
$relationshipsDown
= []
$relationshipsUp
public
array<string|int, mixed>
$relationshipsUp
= []
$scripts
public
array<string|int, mixed>
$scripts
= []
$totalAttributes
public
int|null
$totalAttributes
= null
$totalScripts
public
int|null
$totalScripts
= null
$access_group_ids
protected
array<string|int, mixed>|null
$access_group_ids
= null
$allowed_props
protected
array<string|int, mixed>
$allowed_props
= []
$balance_attribute
protected
Attribute|null
$balance_attribute
= null
$balance_attribute_id
protected
int|null
$balance_attribute_id
= null
$balance_method
protected
string
$balance_method
= 'Balance Attribute'
$base_material_type_ids
protected
mixed|array<string|int, mixed>|null
$base_material_type_ids
= null
$called_constructor
protected
bool
$called_constructor
= false
$class_script
protected
Script|null
$class_script
= null
$created_timestamp
protected
string|null
$created_timestamp
= null
$display_path
protected
string|null
$display_path
= null
$display_scripts
protected
array<string|int, mixed>
$display_scripts
= []
$document
protected
string|null
$document
= null
$edit_status
protected
string|null
$edit_status
= null
$empty_level
protected
string|null
$empty_level
= null
$event_object_types
protected
array<string|int, mixed>
$event_object_types
= []
$full_level
protected
mixed
$full_level
= null
$id_path
protected
string|null
$id_path
= ''
$importance
protected
float|null
$importance
= null
$influence_ratio_limit
protected
float|null
$influence_ratio_limit
= null
$is_root
protected
bool|null
$is_root
= null
$key_attribute_nodes
protected
array<string|int, mixed>
$key_attribute_nodes
= []
$key_attributes
protected
mixed|array<string|int, mixed>|null
$key_attributes
= null
$last_movement_timestamp
protected
string|null
$last_movement_timestamp
= null
$ledger_entries
protected
array<string|int, mixed>
$ledger_entries
= []
$library
protected
Library|null
$library
= null
$material_nodes
protected
array<string|int, mixed>
$material_nodes
= []
$measurement_unit_id
protected
int|null
$measurement_unit_id
= null
The default measurement unit id for this account if none is supplied to its corresponding Ledger Entries
$measurementUnit
protected
MeasurementUnit|null
$measurementUnit
= null
$operating_table
protected
string
$operating_table
= 'accounts'
$part_of_id
protected
int|null
$part_of_id
= null
$process_start_id
protected
int|null
$process_start_id
= null
$process_start_node
protected
Node|null
$process_start_node
= null
$prop_types
protected
array<string|int, mixed>
$prop_types
= []
$relationship
protected
mixed|Relationship
$relationship
= null
$relationship_id
protected
int|null
$relationship_id
= null
$relative_name
protected
string|null
$relative_name
= null
$schema
protected
string
$schema
= 'model'
$system_node_type
protected
SystemNodeType|null
$system_node_type
= null
$system_node_type_id
protected
int|null
$system_node_type_id
= null
$threshold_limit
The minimum movement amount to be considered a movement
protected
float|null
$threshold_limit
= null
$type
protected
Type|null
$type
= null
$type_id
protected
int|null
$type_id
= null
$type_name
protected
string|null
$type_name
= null
$unlink_relative_name
protected
bool|null
$unlink_relative_name
= null
$unsaved_props
protected
array<string|int, mixed>
$unsaved_props
= []
$updated_timestamp
protected
string|null
$updated_timestamp
= null
Methods
__construct()
Node constructor.
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
__debugInfo()
Magic Method called by functions like var_dump and print_r. We prune the object before emitting.
public
__debugInfo() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null__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.
__isset()
Magic hook that methods like empty() and isset() call this method. Without this method code like: `if(empty($node->attr->max_value))` will always be empty, as the properties are protected.
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
bool__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.
__toString()
Called during a print/echo statement, this function returns a html table of all the attributes of the Node, minus the DatabaseTrait properties.
public
__toString() : string
Return values
stringcloseOpenOutFlowMovements()
When we close a flow, we need to create a complete movement. This means that we create a mirrored inflow to the destination which shares a new transaction id.
public
closeOpenOutFlowMovements(DateTime|null $end_timestamp[, string|null $closing_event_string = null ][, int|null $transaction_id = null ]) : void
Parameters
- $end_timestamp : DateTime|null
- $closing_event_string : string|null = null
- $transaction_id : int|null = null
Tags
configErrorMessage()
Returns the configuration error message.
public
static configErrorMessage() : string
Return values
stringdelete()
Delete by ID Cleans up Scripts and other dependant items.
public
delete() : void
deleteLedgerEntries()
public
deleteLedgerEntries(DateTimeInterface|null $start, DateTimeInterface|null $end) : void
Parameters
- $start : DateTimeInterface|null
- $end : DateTimeInterface|null
findNodesByTypes()
Searches down the id path to find any node of the given type (display name or relative name) If depth is set, the search will only go down that many levels
public
findNodesByTypes(string $types[, int|null $depth = null ]) : array<string|int, mixed>
Parameters
- $types : string
- $depth : int|null = null
Tags
Return values
array<string|int, mixed>findObjectByType()
Searches each of the children and if the specify object type is not found, it goes up one level and does a recursion to search the children higher up until we don't have any more parents to search into.
public
findObjectByType(string|array<string|int, int> $ids, string $objectType[, bool $returnFirst = false ][, array<string|int, mixed> $memoize = [] ][, array<string|int, mixed> $objects = [] ]) : array<string|int, mixed>
Parameters
- $ids : string|array<string|int, int>
-
- node_ids we are going to be searching.
- $objectType : string
-
- The type of object we are searching in the tree.
- $returnFirst : bool = false
-
- If set to True, it will return only the first found node in the tree
- $memoize : array<string|int, mixed> = []
-
- Stores the ids that we have traverse in order to speed up the recursive call.
- $objects : array<string|int, mixed> = []
-
- Stores unique objects.
Tags
Return values
array<string|int, mixed> —- an array of objects that contains the type of Object we were searching for.
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
stringgetAccount()
Gets the account information for the given Node
public
getAccount([array<string|int, mixed>|null $additionalMethods = [] ]) : Account|null
Parameters
- $additionalMethods : array<string|int, mixed>|null = []
Tags
Return values
Account|nullgetAllowedProps()
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>getAttributeCount()
Gets the total attribute count of the given node.
public
getAttributeCount([string|null $search_params = null ][, bool $deep_search = false ][, bool $show_hidden_attributes = true ]) : $this
Parameters
- $search_params : string|null = null
-
This parameter is a JSON object.
- $deep_search : bool = false
-
This toggles the ability to search not only immediate children but children of children.
- $show_hidden_attributes : bool = true
-
Enable or disable hidden attributes.
Return values
$thisgetAttributes()
Queries attributes for a given node add attaches it to the node object.
public
getAttributes([string $column = 'display_name' ][, string $order = 'ASC' ][, int|null $limit = null ][, int|null $offset = null ][, string|null $search_params = null ][, bool $deep_search = false ][, false $show_hidden_attributes = true ][, string $default_selected_ids = "" ][, bool $lazy_load = false ]) : $this
Parameters
- $column : string = 'display_name'
-
This is the name of the column we order by.
- $order : string = 'ASC'
-
ASC
orDESC
order. - $limit : int|null = null
-
The amount of rows we want to limit.
- $offset : int|null = null
-
Dictates the number of rows to skip from the beginning of the returned data before presenting the results.
- $search_params : string|null = null
-
This parameter is a JSON object.
- $deep_search : bool = false
-
This toggles the ability to search not only immediate children but children of children.
- $show_hidden_attributes : false = true
-
Enable or disable hidden attributes.
- $default_selected_ids : string = ""
-
to display attributes at the top of the list.
- $lazy_load : bool = false
Tags
Return values
$thisgetBalance()
Gets the balance of an account at a time. If no time is passed, NOW is used. If there are no movements, 0 is returned
public
getBalance([DateTimeInterface|string|null $at_time = null ]) : float
Parameters
- $at_time : DateTimeInterface|string|null = null
Return values
floatgetBalanceAttribute()
public
getBalanceAttribute() : Attribute|null
Tags
Return values
Attribute|nullgetChildren()
public
getChildren([array<string|int, mixed> $additionalMethods = [] ]) : $this
Parameters
- $additionalMethods : array<string|int, mixed> = []
-
- Methods to be call to call when we initiate the class.
Tags
Return values
$thisgetConfig()
Gets the TIQ configuration.
public
static getConfig() : TiqConfig
Return values
TiqConfiggetDb()
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
PgSQLgetDisplayScripts()
Gets the Display scripts associate to this node, will search inheritance path as well as type
public
getDisplayScripts() : Node
Tags
Return values
NodegetEventObjectTypes()
Returns an array of Types that have been used to make event objects for this account
public
getEventObjectTypes() : array<string|int, mixed>|null
TODO: Jono forced this to return null, the underlying query is too slow and will break system usability.
Tags
Return values
array<string|int, mixed>|nullgetFQN()
Returns a human-readable FQN.
public
getFQN([string $delimiter = '.' ][, bool $use_display_names = false ]) : string
Parameters
- $delimiter : string = '.'
-
Optional parameter to separate the relative names.
- $use_display_names : bool = false
-
Optional parameter to return display names instead of relative names.
Tags
Return values
stringgetFQNDisplayPath()
This is a bulk call of the function getFQN for multiple nodes.
public
static getFQNDisplayPath(array<string|int, string>|array<string|int, int>|array<string|int, mixed> $ids[, string $delimiter = '.' ][, bool $reduce = true ]) : array<string|int, mixed>|array<string|int, string>
Parameters
- $ids : array<string|int, string>|array<string|int, int>|array<string|int, mixed>
-
Array of Node ids.
- $delimiter : string = '.'
-
Optional parameter to separate the relative names.
- $reduce : bool = true
-
Dictates whether to reduce the Node path or not,
Return values
array<string|int, mixed>|array<string|int, string>getInFlows()
Gets upstream flows based on an account id and time. The getOne flag is used to test if there are any upstream movements quickly
public
getInFlows(string $timestamp[, bool $getOne = false ]) : array<string|int, mixed>
Parameters
- $timestamp : string
- $getOne : bool = false
Tags
Return values
array<string|int, mixed>getInstance()
Gets current instance of the Node.
public
static getInstance(mixed $identifier[, array<string|int, mixed>|null $config = [] ]) : Node
Parameters
- $identifier : mixed
-
- FQN or ID.
- $config : array<string|int, mixed>|null = []
-
- This array contains the same properties as a record from the corresponding table in the database.
Tags
Return values
NodegetKeyAttributes()
public
getKeyAttributes() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|nullgetLastMovement()
Gets the latest ledgerEntry for this account
public
getLastMovement() : LedgerEntry|false
Tags
Return values
LedgerEntry|falsegetLedgerEntries()
public
getLedgerEntries([int $limit = 1000 ][, int $offset = 0 ][, string|null $direction = null ][, string|null $timestamp = null ]) : array<string|int, mixed>|null
Parameters
- $limit : int = 1000
- $offset : int = 0
- $direction : string|null = null
- $timestamp : string|null = null
Tags
Return values
array<string|int, mixed>|nullgetLibrary()
returns Library this node belongs to, and null for objects.
public
getLibrary() : Library|null
Tags
Return values
Library|nullgetMaterials()
public
getMaterials() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|nullgetMeasurementUnit()
public
getMeasurementUnit() : MeasurementUnit|null
Tags
Return values
MeasurementUnit|nullgetNodeId()
Return the ID from and FQN
public
static getNodeId(string|int $identifier) : int
Parameters
- $identifier : string|int
-
- FQN or ID
Tags
Return values
intgetNodeSet()
Returns a list of all nodes that are for type $identifier to get the type name use "SELECT * FROM model.system_node_types".
public
static getNodeSet(string $identifier[, string $column = 'display_name' ][, string $order = 'ASC' ][, int|null $limit = null ][, int|null $offset = null ][, string|null $search_params = null ][, string $default_selected_ids = "" ][, bool|null $deep_search = false ][, array<string|int, mixed> $additionalMethods = [] ]) : array<string|int, mixed>
Parameters
- $identifier : string
-
- type_name or ID.
- $column : string = 'display_name'
-
- the column we are selecting.
- $order : string = 'ASC'
-
- the order we are going to be returning the records.
- $limit : int|null = null
-
- limits the records return.
- $offset : int|null = null
-
- dictates the number of rows to skip from the beginning of the returned data before presenting the results.
- $search_params : string|null = null
-
- the values we are searching for.
- $default_selected_ids : string = ""
-
- to display attributes at the top of the list.
- $deep_search : bool|null = false
-
- This toggles the ability to search not only immediate children but children of children.
- $additionalMethods : array<string|int, mixed> = []
-
- Additional methods.
Tags
Return values
array<string|int, mixed>getOperatingTable()
Returns the current operating table.
public
getOperatingTable() : string
Return values
stringgetOrCreateAccount()
Gets the account of a node. If there is no account, create a new account with default properties and the same name as its parent.
public
static getOrCreateAccount(Node|int|string $parent_node) : Account
Parameters
- $parent_node : Node|int|string
Tags
Return values
AccountgetOutFlows()
Gets downstream flows based on an account id and time. The getOne flag is used to test if there are any downstream movements quickly
public
getOutFlows(string $timestamp[, bool $getOne = false ]) : array<string|int, mixed>
Parameters
- $timestamp : string
- $getOne : bool = false
Tags
Return values
array<string|int, mixed>getParent()
This function fetches all the nodes one level up.
public
getParent([array<string|int, mixed> $additionalMethods = [] ]) : $this
Parameters
- $additionalMethods : array<string|int, mixed> = []
-
- Methods to be call to call when we initiate the class.
Tags
Return values
$thisgetProcessStartNode()
Loads the State data into the Attribute Class instance.
public
getProcessStartNode() : void
Currently, only loads the state name
Tags
getRelationshipsDown()
Gets all direct children nodes.
public
getRelationshipsDown() : Node
Tags
Return values
NodegetRelationshipsUp()
Gets all direct parent nodes.
public
getRelationshipsUp() : Node
Tags
Return values
NodegetScripts()
Gets the scripts associate to this node.
public
getScripts([bool $deep_search = false ]) : Node
Parameters
- $deep_search : bool = false
Tags
Return values
NodegetSystemType()
Sets the system type name of the given attribute.
public
getSystemType() : Node
Return values
NodegetTaxonomySystemNodeTypeId()
Gets the Taxonomy System Node Type ID.
public
static getTaxonomySystemNodeTypeId(string|int $id) : int
Parameters
- $id : string|int
-
FQN or ID
Return values
intgetType()
sets a Type model based on the current type_id.
public
getType() : Type|null
Tags
Return values
Type|nullhasClassScript()
Checks all the nodes' script to see if there is a class script.
public
hasClassScript() : bool
Tags
Return values
boolisDebug()
Is debug mode or not.
public
static isDebug() : bool
Return values
booljsonSerialize()
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>loadOpenSourceAccounts()
public
loadOpenSourceAccounts([bool $latest_only = true ]) : array<string|int, mixed>
Parameters
- $latest_only : bool = true
Tags
Return values
array<string|int, mixed>processSources()
load previous state (open flows) intersect the new flows with open flows - create open flows that exist in new flows and not open flows create open outflows on the source account of the new flows if count(new_flows) > 0 && count(open_flows) === 0 open an inflow on the destination - close flows that exist in open flows and not new flows create movements from closed flows if count(new_flows) === 0 && count(open_flows) > 0 close the destination's side movements - do nothing if the new flow exists in the open flows
public
processSources(array<string|int, mixed> $sources_accounts[, string|null $closing_reasoning = null ]) : void
Parameters
- $sources_accounts : array<string|int, mixed>
- $closing_reasoning : string|null = null
Tags
reduceFQN()
Handles to reduce the FQN paths to help the UI for the client.
public
static reduceFQN(array<string|int, mixed> $paths[, string $delimiter = '.' ]) : array<string|int, string>
Parameters
- $paths : array<string|int, mixed>
-
A multidimensional array that contains paths and ids we want to reduce.
- $delimiter : string = '.'
-
Optional parameter to separate the relative names.
Return values
array<string|int, string>save()
writes updated properties into the database, or creates it if it does not exist.
public
save() : void
Tags
convertPostgresTypeArray()
Take a postgres typed array and converts it to a php array e.g. {"test 1","test 2"} from postgres will yield ["test 1", "test 2"]
protected
convertPostgresTypeArray(string|null $data[, string $type_hint = 'string' ]) : array<string|int, mixed>
Parameters
- $data : string|null
-
- The postgres typed array.
- $type_hint : string = 'string'
Tags
Return values
array<string|int, mixed>getTypeName()
Gets the Type Name.
protected
getTypeName() : string
Return values
stringsetProps()
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.