Add API function: return a monitor's zones
This commit is contained in:
parent
b655883345
commit
d56e0762f4
|
@ -49,6 +49,23 @@ class ZonesController extends AppController {
|
|||
));
|
||||
}
|
||||
|
||||
// Find all zones which belong to a MonitorId
|
||||
public function forMonitor($id = null) {
|
||||
$this->loadModel('Monitor');
|
||||
if (!$this->Monitor->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid monitor'));
|
||||
}
|
||||
|
||||
$this->Zone->recursive = -1;
|
||||
|
||||
$zones = $this->Zone->find('all', array(
|
||||
'conditions' => array('MonitorId' => $id)
|
||||
));
|
||||
$this->set(array(
|
||||
'zones' => $zones,
|
||||
'_serialize' => array('zones')
|
||||
));
|
||||
}
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue