fix: [eventGraph] prevents bug if object has no attributes

pull/3723/head
Sami Mokaddem 2018-09-28 12:05:46 +02:00
parent ae829783dc
commit b66eeefffa
1 changed files with 15 additions and 9 deletions

View File

@ -110,10 +110,12 @@
// value rule - search in the object's atribute value
$valueMatch = true;
foreach ($obj['Attribute'] as $attr) {
$valueMatch = $this->__satisfy_val_filtering($attr);
if (!$valueMatch) {
return false;
if (isset($obj['Attribute'])) {
foreach ($obj['Attribute'] as $attr) {
$valueMatch = $this->__satisfy_val_filtering($attr);
if (!$valueMatch) {
return false;
}
}
}
return true;
@ -266,20 +268,24 @@
'id' => $obj['id'],
'uuid' => $obj['uuid'],
'type' => $obj['name'],
'Attribute' => $obj['Attribute'],
'label' => '',
'Attribute' => [],
'node_type' => 'object',
'meta-category' => $obj['meta-category'],
'template_uuid' => $obj['template_uuid'],
'event_id' => $obj['event_id'],
);
array_push($this->__json['items'], $toPush);
if (isset($obj['Attribute'])) {
$toPush['Attribute'] = $obj['Attribute'];
// Record existing object_relation
foreach ($obj['Attribute'] as $attr) {
$this->__json['existing_object_relation'][$attr['object_relation']] = 0; // set-alike
// Record existing object_relation
foreach ($obj['Attribute'] as $attr) {
$this->__json['existing_object_relation'][$attr['object_relation']] = 0; // set-alike
}
}
array_push($this->__json['items'], $toPush);
foreach ($obj['ObjectReference'] as $rel) {
$toPush = array(
'id' => $rel['id'],