backend ->select() ->from('downtime', array('host_name', 'id' => 'downtime_internal_id')) ->where('object_type', 'host') ->applyFilter($this->getRestriction('monitoring/filter/objects')) ->handleRequest($this->getRequest()) ->fetchAll(); if (empty($downtimes)) { // @TODO(el): Use ApiResponse class for unified response handling. $this->getRequest()->sendJson(array( 'status' => 'error', 'message' => 'No downtimes found matching the given filter' )); } $form = new DeleteDowntimesCommandForm(); $form ->setIsApiTarget(true) ->setDowntimes($downtimes) ->handleRequest($this->getRequest()); // @TODO(el): Respond w/ the downtimes deleted instead of the notifiaction added by // DeleteDowntimesCommandForm::onSuccess(). } }