getFilter()) { $fields = [Destination::TYPE, Destination::NAME, Destination::NOTES]; $query->search($fields, $filter); } $output = $this->isCLI() ? [] : [ 'destinations' => [], 'total' => count($query->getQuery()->fetch()) ]; if($this->getLimit()) $query->limit($this->getLimit()); if($this->getSkip()) $query->skip($this->getSkip()); if($this->getSort()) $query->orderBy($this->getSort()); $list = $query->getQuery()->fetch(); foreach($list as $destination_details) { $destination = new Destination($destination_details[JetBackup::ID_FIELD]); if($this->isCLI()) $output[] = $destination->getDisplayCLI(); else $output['destinations'][] = $destination->getDisplay(); } $this->setResponseData($output); } }