protected function StatusReportController::getClientEntities in Acquia Content Hub 8.2
Returns only subscribers with interests and metric data.
Return value
array All subscriber cdf data that have interests in the service
Throws
\Exception
1 call to StatusReportController::getClientEntities()
- StatusReportController::getWebhooksPageSection in modules/
acquia_contenthub_publisher/ src/ Controller/ StatusReportController.php - Returns the Webhooks page section.
File
- modules/
acquia_contenthub_publisher/ src/ Controller/ StatusReportController.php, line 213
Class
- StatusReportController
- Controller for Status Reports.
Namespace
Drupal\acquia_contenthub_publisher\ControllerCode
protected function getClientEntities($page) {
$subscribers = [];
// Search only client entities that are not the current client.
$options = [
"from" => $page * self::LIMIT,
"query" => [
"bool" => [
"filter" => [
[
"term" => [
"data.type" => 'client',
],
],
],
],
],
"size" => self::LIMIT,
"sort" => [
"data.modified" => "desc",
],
];
$client_entities = $this->client
->searchEntity($options) ?? [];
$subscribers['data'] = [];
$subscribers['total'] = 0;
$subscribers['total_pages'] = 1;
$subscribers['results'] = [];
if (!empty($client_entities['hits']['hits'])) {
foreach ($client_entities['hits']['hits'] as $key => $client_entity) {
if (!isset($client_entity['_source']['data']['metadata']['settings']['uuid'])) {
continue;
}
$subscribers['data'][] = $client_entity['_source']['data'];
}
$subscribers['total'] = $client_entities['hits']['total'];
$subscribers['total_pages'] = ceil($subscribers['total'] / self::LIMIT);
$subscribers['results'] = $subscribers['data'];
}
return $subscribers;
}