hello
i had stumbled on kinda simple problem but i can't get and idea what could be wrong:
function zabbixGraphGetId($HostName, $Name,$zabbixData) {
try {
$api = new ZabbixApi(...$zabbixData);
} catch (Exception $e) {
// Exception in ZabbixApi catched
echo $e->getMessage();
}
$GetGraphId = $api->graphGet(array(
'output' => 'extend',
'filter' => array('host' => $HostName),
'search' => array('name' => $Name)
));
$ReturnGraphId = $GetGraphId['0']->graphid;
return $ReturnGraphId;
}
Thats my function in symfony and i want to get from array $GetGraphId value of only graphid. Point is after i call this function i get this error: Warning: Attempt to read property "graphid" on array But if i'll return whole array($GetGraphId) i get this:
array:2 [
0 => array:19 [
"graphid" => "some id"
"name" => "Network traffic on tun0"
"width" => "900"
"height" => "200"
"yaxismin" => "0"
"yaxismax" => "100"
"templateid" => "0"
"show_work_period" => "1"
"show_triggers" => "1"
"graphtype" => "0"
"show_legend" => "1"
"show_3d" => "0"
"percent_left" => "0"
"percent_right" => "0"
"ymin_type" => "1"
"ymax_type" => "0"
"ymin_itemid" => "0"
"ymax_itemid" => "0"
"flags" => "4"
]
so there is graphid value yet i still cant get it, i would really appreciate any clues/ideas/solutions thanks!
The warning says it: Attempt to read property "graphid" on array. You cannot access graphid with object->property notation. Use this line instead:
$ReturnGraphId = $GetGraphId['0']['graphid'];