minor fix

Former-commit-id: 1ccd9e446645362fb9b305a699527c5aa2c20369
This commit is contained in:
fbsanchez 2019-03-22 14:43:55 +01:00
parent bc1195e78e
commit a4c048dd29

View File

@ -1980,41 +1980,49 @@ class NetworkMap
$i++; $i++;
} }
// Search for relations. if (!$this->relations) {
foreach ($this->nodes as $k => $item) { // Search for relations.
$target = $this->calculateRelations($k); foreach ($this->nodes as $k => $item) {
$target = $this->calculateRelations($k);
// Adopt all orphan nodes but pandora one. // Adopt all orphan nodes but pandora one.
if (empty($target)) { if (empty($target)) {
if (isset($this->noPandoraNode) === false if (isset($this->noPandoraNode) === false
|| $this->noPandoraNode == false || $this->noPandoraNode == false
) { ) {
if ($item['id_node'] != 0) { if ($item['id_node'] != 0) {
$rel = []; $rel = [];
$rel['id_parent'] = 0; $rel['id_parent'] = 0;
$rel['id_child'] = $item['id_node']; $rel['id_child'] = $item['id_node'];
$rel['parent_type'] = NODE_PANDORA; $rel['parent_type'] = NODE_PANDORA;
$rel['child_type'] = $item['node_type']; $rel['child_type'] = $item['node_type'];
$rel['id_child_source_data'] = $item['id_source_data']; $rel['id_child_source_data'] = $item['id_source_data'];
$orphans[] = $rel; $orphans[] = $rel;
}
}
} else {
// Flattern edges.
foreach ($target as $rel) {
$edges[] = $rel;
} }
} }
} else {
// Flattern edges.
foreach ($target as $rel) {
$edges[] = $rel;
}
} }
} else {
$edges = $this->relations;
} }
foreach ($edges as $rel) { if (is_array($edges)) {
$graph .= $this->createDotEdge( foreach ($edges as $rel) {
[ $graph .= $this->createDotEdge(
'to' => $rel['id_child'], [
'from' => $rel['id_parent'], 'to' => $rel['id_child'],
] 'from' => $rel['id_parent'],
); ]
);
}
} else {
$edges = [];
} }
if (isset($this->noPandoraNode) === false if (isset($this->noPandoraNode) === false