Don't query for Monitors if there are no Monitors in the Group.

pull/3588/head
Isaac Connor 2022-08-30 19:35:47 +02:00
parent 54f87aa4cf
commit 4668534bf9
1 changed files with 60 additions and 55 deletions

View File

@ -187,7 +187,12 @@ class Group extends ZM_Object {
}
public function Monitors() {
if (!property_exists($this, 'Monitors') ) {
$this->{'Monitors'} = Monitor::find(array('Id'=>$this->MonitorIds()));
$monitor_ids = $this->MonitorIds();
if (count($monitor_ids)) {
$this->{'Monitors'} = Monitor::find(array('Id'=>$monitor_ids));
} else {
$this->{'Monitors'} = array();
}
}
return $this->{'Monitors'};
}