OpcuaObject
extends NodesWithTags
in package
Class OpcuaObject.
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>
- $description : string
- $display_name : string
- $error_message : string
- $fqn : string
- $id : string
- $nodes : array<string|int, mixed>
- $parent : Node|null
- $relationshipsDown : array<string|int, mixed>
- $relationshipsUp : array<string|int, mixed>
- $scripts : array<string|int, mixed>
- $tag_path : string|null
- $totalAttributes : int|null
- $totalScripts : int|null
- $type_name : string
- $access_group_ids : array<string|int, mixed>|null
- $allowed_props : array<string|int, mixed>
- $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
- $id_path : string|null
- $importance : float|null
- $is_root : bool|null
- $library : Library|null
- $operating_table : string
- $part_of_id : int|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
- $tags : array<string|int, mixed>
- $totalTags : int|null
- $type : Type|null
- $type_id : int|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.
- configErrorMessage() : string
- Returns the configuration error message.
- delete() : void
- Delete by ID Cleans up Scripts and other dependant items.
- 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.
- 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
- 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.
- getInstance() : Node
- Gets current instance of the Node.
- getLibrary() : Library|null
- returns Library this node belongs to, and null for objects.
- 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.
- getParent() : $this
- This function fetches all the nodes one level up.
- 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.
- getTagCount() : mixed
- Gets the total tag count for the given node
- getTagPath() : mixed
- Gets the tag path when looking down the tree
- getTags() : array<string|int, mixed>
- Gets the tags for the given node
- 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
- 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
= []
$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
$nodes
public
array<string|int, mixed>
$nodes
= []
$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
= []
$tag_path
public
string|null
$tag_path
= null
$totalAttributes
public
int|null
$totalAttributes
= null
$totalScripts
public
int|null
$totalScripts
= null
$type_name
public
string
$type_name
$access_group_ids
protected
array<string|int, mixed>|null
$access_group_ids
= null
$allowed_props
protected
array<string|int, mixed>
$allowed_props
= []
$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
$id_path
protected
string|null
$id_path
= ''
$importance
protected
float|null
$importance
= null
$is_root
protected
bool|null
$is_root
= null
$library
protected
Library|null
$library
= null
$operating_table
protected
string
$operating_table
= 'opcua_objects'
$part_of_id
protected
int|null
$part_of_id
= 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
$tags
protected
array<string|int, mixed>
$tags
= []
$totalTags
protected
int|null
$totalTags
= null
$type
protected
Type|null
$type
= null
$type_id
protected
int|null
$type_id
= 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 when 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
stringconfigErrorMessage()
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
Tags
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
$thisgetChildren()
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
NodegetFQN()
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>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
NodegetLibrary()
returns Library this node belongs to, and null for objects.
public
getLibrary() : Library|null
Tags
Return values
Library|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
stringgetParent()
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
$thisgetRelationshipsDown()
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
NodegetTagCount()
Gets the total tag count for the given node
public
static getTagCount(int $id[, string|null $search_params = null ][, bool $deep_search = false ]) : mixed
Parameters
- $id : int
-
- Tag id
- $search_params : string|null = null
-
- This parameter is a JSON object.
- $deep_search : bool = false
-
- Enables deep search.
getTagPath()
Gets the tag path when looking down the tree
public
static getTagPath(int $id, string $relative_name) : mixed
Parameters
- $id : int
-
- Tag id.
- $relative_name : string
-
- The relative name of tag.
getTags()
Gets the tags for the given node
public
static getTags(int $id[, string $column = 'display_name' ][, string $order = 'ASC' ][, int|null $limit = null ][, int|null $offset = null ][, string|null $search_params = null ][, bool $deep_search = false ][, string $default_selected_ids = "" ]) : array<string|int, mixed>
Parameters
- $id : int
-
- Tag id.
- $column : string = 'display_name'
-
- This is the name of the column we order by.
- $order : string = 'ASC'
-
- Sets the order of with the results.
- $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
-
- This parameter is a JSON object.
- $deep_search : bool = false
-
- This toggles the ability to search not only immediate children but children of children.
- $default_selected_ids : string = ""
-
- to display tags at the top of the list.
Tags
Return values
array<string|int, mixed>getTaxonomySystemNodeTypeId()
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>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.