Attribute
extends Node
in package
uses
EventObjectTrait
Attributes store data that can changes over time, or static data that stays the same. Attributes are similar to what developers call Properties.
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_status : string|null
- $current_timestamp : string|null
- $current_value : mixed|null
- $description : string
- $display_name : string
- $error_message : string
- $id : string
- $is_stale : bool|null
- $last_reported : string|null
- $nodes : 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
- $type_name : string
- $access_group_ids : array<string|int, mixed>|null
- $allowed_props : array<string|int, mixed>
- $attr_type : string|null
- $attribute_type_id : int|null
- $bool_value : bool|null
- $called_constructor : bool
- $class_script : Script|null
- $created_timestamp : string|null
- $data_source : string|null
- $data_source_value : string|null
- $data_type : string|null
- $datetime_value : string|null
- $display_path : string|null
- $display_scripts : array<string|int, mixed>
- $document : string|null
- $edit_status : string|null
- $enumeration_name : string|null
- $enumeration_type : EnumerationType|null
- $enumeration_type_id : int|null
- $enumeration_value : string|null
- $enumeration_values : mixed|array<string|int, mixed>|null
- $expiration_interval : string|null
- $expression : string|null
- $float_value : string|null
- $fqn : string|null
- $geopoint_value : string|null
- $icon : string|null
- $id_path : string|null
- $importance : float|null
- $int_value : string|null
- $interpolation_method : string|null
- $interval_value : string|null
- $is_hidden : bool|null
- $is_root : bool|null
- $latitude : float|null
- $library : Library|null
- $limit : string|null
- $limit_color : string|null
- $limit_hi : string|null
- $limit_hihi : string|null
- $limit_lo : string|null
- $limit_lolo : string|null
- $limits : array<string|int, mixed>|null
- $longitude : float|null
- $maverick : string|null
- $max_value : string|null
- $measurement_unit : string|null
- $measurement_unit_id : int|null
- $measurement_unit_symbol : string|null
- $min_value : string|null
- $object_history_type : Type|null
- $object_history_type_id : int|null
- $object_value : string|null
- $operating_table : string
- $parent_name : string|null
- $part_of_id : int|null
- $prop_types : array<string|int, mixed>
- $quantity_id : int|null
- $range : string|null
- $referenced_node : Node|null
- $referenced_node_id : int|null
- $relationship : mixed|Relationship
- $relationship_id : int|null
- $relative_name : string|null
- $schema : string
- $source_config : string|null
- $string_value : string|null
- $system_node_type : SystemNodeType|null
- $system_node_type_id : int|null
- $tag : Tag|null
- $tag_id : int|null
- $target_value : string|null
- $type : Type|null
- $type_id : int|null
- $type_to_attribute_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.
- createLimit() : Limit
- Check if the limit already exists, if it doesn't create it and set the values.
- decode() : mixed
- Takes a value or an array of values and decodes them into their respective enumeration names. If a single value is supplied, a single name is returned
- delete() : void
- Delete by ID Cleans up Scripts and other dependant items.
- deleteTimeSeriesAfter() : array<string|int, mixed>
- Deletes time series data after a specified timestamp
- deleteTimeSeriesBefore() : array<string|int, mixed>
- Deletes time series data before a specified timestamp
- deleteTimeSeriesRange() : array<string|int, mixed>
- Deletes time series data within a specified time range
- encode() : mixed
- Takes a name or an array of names and encodes them into their respective enumeration values. If a single name is supplied, a single value is returned
- findAdjMinMaxForAttribute() : array<string|int, mixed>|bool
- Generates the Attribute min, max ranges
- 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() : Node
- We have stubbed this out, because attributes cannot have attributes.
- getChildren() : $this
- getConfig() : TiqConfig
- Gets the TIQ configuration.
- getCurrentValue() : array<string|int, mixed>
- Returns an array with the current value of the attribute, is_stale flag, and last_reported time ina human readable format.
- getDb() : PgSQL
- Gets database instance.
- getDisplayScripts() : Node
- Gets the Display scripts associate to this node, will search inheritance path as well as type
- getEnumerationType() : EnumerationType|null
- Loads the State data into the Attribute Class instance.
- 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.
- getGeoCoordinates() : void
- Sets the GeoCoordinates of a geopoint config attribute
- getInstance() : Node
- Gets current instance of the Node.
- getLibrary() : Library|null
- returns Library this node belongs to, and null for objects.
- getLimit() : string
- Check the position of the current value in limits range; depending upon the position, it returns the color name.
- getLimits() : Node
- Gets the Model attribute limits by the part of id row.
- getMeasurementUnits() : void
- Get the measurement Unit of the given attribute and sets the unit of measure
- 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".
- getObjectHistoryType() : void
- Gets the type associated with the Object Event.
- getOperatingTable() : string
- Returns the current operating table.
- getParent() : $this
- This function fetches all the nodes one level up.
- getParentName() : void
- Loads the Parent Node data into the Attribute Class instance.
- getReferencedNode() : void
- Sets the reference object.
- 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.
- getTag() : void
- Loads the Tag data into the Attribute Class instance.
- getTargetValue() : string|null
- Gets the Attribute target value
- getTaxonomySystemNodeTypeId() : int
- Gets the Taxonomy System Node Type ID.
- getTimeSeries() : array<string|int, mixed>|ValueStream
- Gets time series for the current Attribute.
- 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.
- insertTimeSeries() : array<string|int, mixed>
- Inserts Time Series data into an attribute given equal length arrays of data, timestamps, and optional quality.
- isDebug() : bool
- Is debug mode or not.
- isVision() : bool
- Check if there is a mediator that feeds this attribute.
- isWired() : bool
- Checks whether an attribute is connected to data.
- 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.
- validateExpression() : bool|array<string|int, mixed>
- Validates the given expression.
- 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_status
public
string|null
$current_status
= null
$current_timestamp
public
string|null
$current_timestamp
= null
$current_value
public
mixed|null
$current_value
= 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
$id
public
string
$id
$is_stale
public
bool|null
$is_stale
= null
$last_reported
public
string|null
$last_reported
= null
$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
= []
$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
= []
$attr_type
protected
string|null
$attr_type
= null
$attribute_type_id
protected
int|null
$attribute_type_id
= null
$bool_value
protected
bool|null
$bool_value
= null
$called_constructor
protected
bool
$called_constructor
= false
$class_script
protected
Script|null
$class_script
= null
$created_timestamp
protected
string|null
$created_timestamp
= null
$data_source
protected
string|null
$data_source
= null
$data_source_value
protected
string|null
$data_source_value
= null
$data_type
protected
string|null
$data_type
= null
$datetime_value
protected
string|null
$datetime_value
= 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
$enumeration_name
protected
string|null
$enumeration_name
= null
$enumeration_type
protected
EnumerationType|null
$enumeration_type
= null
$enumeration_type_id
protected
int|null
$enumeration_type_id
= null
$enumeration_value
protected
string|null
$enumeration_value
= null
$enumeration_values
protected
mixed|array<string|int, mixed>|null
$enumeration_values
= null
$expiration_interval
protected
string|null
$expiration_interval
= null
$expression
protected
string|null
$expression
= null
$float_value
protected
string|null
$float_value
= null
$fqn
protected
string|null
$fqn
= null
$geopoint_value
protected
string|null
$geopoint_value
= null
$icon
protected
string|null
$icon
= null
$id_path
protected
string|null
$id_path
= ''
$importance
protected
float|null
$importance
= null
$int_value
protected
string|null
$int_value
= null
$interpolation_method
protected
string|null
$interpolation_method
= null
$interval_value
protected
string|null
$interval_value
= null
$is_hidden
protected
bool|null
$is_hidden
= null
$is_root
protected
bool|null
$is_root
= null
$latitude
protected
float|null
$latitude
= null
$library
protected
Library|null
$library
= null
$limit
protected
string|null
$limit
= null
$limit_color
protected
string|null
$limit_color
= null
$limit_hi
protected
string|null
$limit_hi
= null
$limit_hihi
protected
string|null
$limit_hihi
= null
$limit_lo
protected
string|null
$limit_lo
= null
$limit_lolo
protected
string|null
$limit_lolo
= null
$limits
protected
array<string|int, mixed>|null
$limits
= null
$longitude
protected
float|null
$longitude
= null
$maverick
protected
string|null
$maverick
= null
$max_value
protected
string|null
$max_value
= null
$measurement_unit
protected
string|null
$measurement_unit
= null
$measurement_unit_id
protected
int|null
$measurement_unit_id
= null
$measurement_unit_symbol
protected
string|null
$measurement_unit_symbol
= null
$min_value
protected
string|null
$min_value
= null
$object_history_type
protected
Type|null
$object_history_type
= null
$object_history_type_id
protected
int|null
$object_history_type_id
= null
- Type id associated with the attribute Object.
$object_value
protected
string|null
$object_value
= null
$operating_table
protected
string
$operating_table
= 'attributes'
$parent_name
protected
string|null
$parent_name
= null
$part_of_id
protected
int|null
$part_of_id
= null
$prop_types
protected
array<string|int, mixed>
$prop_types
= []
$quantity_id
protected
int|null
$quantity_id
= null
$range
protected
string|null
$range
= null
$referenced_node
protected
Node|null
$referenced_node
= null
$referenced_node_id
protected
int|null
$referenced_node_id
= null
$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'
$source_config
protected
string|null
$source_config
= null
$string_value
protected
string|null
$string_value
= null
$system_node_type
protected
SystemNodeType|null
$system_node_type
= null
$system_node_type_id
protected
int|null
$system_node_type_id
= null
$tag
protected
Tag|null
$tag
= null
$tag_id
protected
int|null
$tag_id
= null
$target_value
protected
string|null
$target_value
= null
$type
protected
Type|null
$type
= null
$type_id
protected
int|null
$type_id
= null
$type_to_attribute_type_id
protected
int|null
$type_to_attribute_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 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
stringcreateLimit()
Check if the limit already exists, if it doesn't create it and set the values.
public
createLimit(string $name, float $value) : Limit
Parameters
- $name : string
-
- Must be HiHi, Hi, Lo, LoLo or target.
- $value : float
-
- The value we are going to set as a limit.
Return values
Limitdecode()
Takes a value or an array of values and decodes them into their respective enumeration names. If a single value is supplied, a single name is returned
public
decode(mixed $values) : mixed
Parameters
- $values : mixed
Tags
delete()
Delete by ID Cleans up Scripts and other dependant items.
public
delete() : void
Tags
deleteTimeSeriesAfter()
Deletes time series data after a specified timestamp
public
deleteTimeSeriesAfter(DateTimeInterface|string $timestamp) : array<string|int, mixed>
Parameters
- $timestamp : DateTimeInterface|string
-
- php DateTime or an SQL safe string representing the cutoff time
Tags
Return values
array<string|int, mixed> —- array with keys 'rows_deleted' and 'rows_inserted' indicating records affected
deleteTimeSeriesBefore()
Deletes time series data before a specified timestamp
public
deleteTimeSeriesBefore(DateTimeInterface|string $timestamp) : array<string|int, mixed>
Parameters
- $timestamp : DateTimeInterface|string
-
- php DateTime or an SQL safe string representing the cutoff time
Tags
Return values
array<string|int, mixed> —- array with keys 'rows_deleted' and 'rows_inserted' indicating records affected
deleteTimeSeriesRange()
Deletes time series data within a specified time range
public
deleteTimeSeriesRange(DateTimeInterface|string $start, DateTimeInterface|string $end) : array<string|int, mixed>
Parameters
- $start : DateTimeInterface|string
-
- php DateTime or an SQL safe string representing the start time
- $end : DateTimeInterface|string
-
- php DateTime or an SQL safe string representing the end time
Tags
Return values
array<string|int, mixed> —- array with keys 'rows_deleted' and 'rows_inserted' indicating records affected
encode()
Takes a name or an array of names and encodes them into their respective enumeration values. If a single name is supplied, a single value is returned
public
encode(mixed $values) : mixed
Parameters
- $values : mixed
Tags
findAdjMinMaxForAttribute()
Generates the Attribute min, max ranges
public
findAdjMinMaxForAttribute() : array<string|int, mixed>|bool
Tags
Return values
array<string|int, mixed>|boolfindNodesByTypes()
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()
We have stubbed this out, because attributes cannot have attributes.
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 = true ][, bool $show_hidden_attributes = false ][, string $default_selected_ids = "" ][, bool $lazy_load = false ]) : Node
Parameters
- $column : string = 'display_name'
- $order : string = 'ASC'
- $limit : int|null = null
- $offset : int|null = null
- $search_params : string|null = null
- $deep_search : bool = true
- $show_hidden_attributes : bool = false
- $default_selected_ids : string = ""
- $lazy_load : bool = false
Return values
NodegetChildren()
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
TiqConfiggetCurrentValue()
Returns an array with the current value of the attribute, is_stale flag, and last_reported time ina human readable format.
public
getCurrentValue([string|DateTimeInterface|null $date_time = null ]) : array<string|int, mixed>
Also sets these values as properties in the class itself.
Parameters
- $date_time : string|DateTimeInterface|null = null
Tags
Return values
array<string|int, mixed> —[ 'value' => mixed | null, 'status' => null | string, 'last_reported' => null | string, 'is_stale' => bool | null, 'time_stamp' => string, ];
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
PgSQLgetDisplayScripts()
Gets the Display scripts associate to this node, will search inheritance path as well as type
public
getDisplayScripts() : Node
Tags
Return values
NodegetEnumerationType()
Loads the State data into the Attribute Class instance.
public
getEnumerationType() : EnumerationType|null
Currently, only loads the state name
Tags
Return values
EnumerationType|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>getGeoCoordinates()
Sets the GeoCoordinates of a geopoint config attribute
public
getGeoCoordinates() : void
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|nullgetLimit()
Check the position of the current value in limits range; depending upon the position, it returns the color name.
public
getLimit() : string
Tags
Return values
stringgetLimits()
Gets the Model attribute limits by the part of id row.
public
getLimits() : Node
Tags
Return values
NodegetMeasurementUnits()
Get the measurement Unit of the given attribute and sets the unit of measure
public
getMeasurementUnits() : void
Tags
getNodeId()
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>getObjectHistoryType()
Gets the type associated with the Object Event.
public
getObjectHistoryType() : void
Tags
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
$thisgetParentName()
Loads the Parent Node data into the Attribute Class instance.
public
getParentName() : void
Tags
getReferencedNode()
Sets the reference object.
public
getReferencedNode() : void
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
NodegetTag()
Loads the Tag data into the Attribute Class instance.
public
getTag() : void
Currently, only loads the tag name into the source_config (data_source?...)
Tags
getTargetValue()
Gets the Attribute target value
public
getTargetValue() : string|null
Return values
string|nullgetTaxonomySystemNodeTypeId()
Gets the Taxonomy System Node Type ID.
public
static getTaxonomySystemNodeTypeId(string|int $id) : int
Parameters
- $id : string|int
-
FQN or ID
Return values
intgetTimeSeries()
Gets time series for the current Attribute.
public
getTimeSeries(DateTimeInterface|string $start, DateTimeInterface|string $end[, bool $withMedia = false ][, int $limitMedia = 5 ]) : array<string|int, mixed>|ValueStream
Parameters
- $start : DateTimeInterface|string
-
- if a string is passed in it must be a SQL compliant date
- $end : DateTimeInterface|string
-
- if a string is passed in it must be a SQL compliant date
- $withMedia : bool = false
-
- default false, will return media associated with the time series
- $limitMedia : int = 5
-
- limit of Vision media links to add to the result, if the user passes 0, it will add all media links
Tags
Return values
array<string|int, mixed>|ValueStreamgetType()
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
boolinsertTimeSeries()
Inserts Time Series data into an attribute given equal length arrays of data, timestamps, and optional quality.
public
insertTimeSeries(array<string|int, mixed> $values, array<string|int, mixed> $timestamps[, array<string|int, mixed>|null $quality = [] ][, bool $flush = true ]) : array<string|int, mixed>
Parameters
- $values : array<string|int, mixed>
-
- An array of values that we want to set its quality and timestamp.
- $timestamps : array<string|int, mixed>
-
- An array that contains php Datetime or an SQL safe string
- $quality : array<string|int, mixed>|null = []
-
- An array of strings ("good" or "bad") that determine whether the quality is good or bad.
- $flush : bool = true
-
- default true, will flush the current values in history, otherwise will append the new values
Tags
Return values
array<string|int, mixed>isDebug()
Is debug mode or not.
public
static isDebug() : bool
Return values
boolisVision()
Check if there is a mediator that feeds this attribute.
public
isVision() : bool
Return values
boolisWired()
Checks whether an attribute is connected to data.
public
isWired() : bool
"Connected to data" means the attribute has a tag, or has an expression, or is internal with data
Tags
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
validateExpression()
Validates the given expression.
public
static validateExpression(mixed $rootId, mixed $expression) : bool|array<string|int, mixed>
Parameters
- $rootId : mixed
-
- The id we are trying to validate.
- $expression : mixed
-
- The expression we are trying to validate.
Return values
bool|array<string|int, mixed>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.