You are here

public function PushNotificationsTokenQuery::getAllTokens in Push Notifications 8

Get all the push notification tokens.

Return value

array

File

src/PushNotificationsTokenQuery.php, line 100
Contains Drupal\push_notifications\PushNotificationsTokenQuery.

Class

PushNotificationsTokenQuery

Namespace

Drupal\push_notifications

Code

public function getAllTokens() {
  $push_notifications_token_storage = $this->entityManager
    ->getStorage('push_notifications_token');
  $push_notifications_token = $push_notifications_token_storage
    ->loadMultiple();

  // Retrieve all tokens into array.
  $tokens = array();
  foreach ($push_notifications_token as $pid => $push_notification_token) {
    array_push($tokens, $push_notification_token
      ->getToken());
  }
  return $tokens;
}