Fix children MonitorIds not being included due to the use of + instead of array_merge
parent
b87c86621a
commit
8bb368fe13
|
@ -48,12 +48,14 @@ class Group extends ZM_Object {
|
|||
} // end public function depth
|
||||
|
||||
public function MonitorIds( ) {
|
||||
if ( ! property_exists($this, 'MonitorIds') ) {
|
||||
if (!property_exists($this, 'MonitorIds')) {
|
||||
if (!isset($monitor_ids_cache[$this->{'Id'}])) {
|
||||
$monitor_ids_cache[$this->{'Id'}] = dbFetchAll('SELECT `MonitorId` FROM `Groups_Monitors` WHERE `GroupId`=?', 'MonitorId', array($this->{'Id'}));
|
||||
if (count($this->Children())) {
|
||||
foreach ($this->Children() as $g)
|
||||
$monitor_ids_cache[$this->{'Id'}] += $g->MonitorIds();
|
||||
foreach ($this->Children() as $g) {
|
||||
$child_monitor_ids = $g->MonitorIds();
|
||||
$monitor_ids_cache[$this->{'Id'}] = array_unique(array_merge($monitor_ids_cache[$this->{'Id'}], $child_monitor_ids));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->{'MonitorIds'} = &$monitor_ids_cache[$this->{'Id'}];
|
||||
|
|
Loading…
Reference in New Issue