private function getNotificationIds(AccountInterface $account, array $status = [], Entity $entity = NULL) {
    $destinations = ['notifications'];

    $uid = $account->id();

    $entity_query = \Drupal::entityQuery('activity');
    $entity_query->condition('field_activity_recipient_user', $uid, '=');
    $entity_query->condition('field_activity_destinations', $destinations, 'IN');

    if ($entity !== NULL) {
      $entity_type = $entity->getEntityTypeId();
      $entity_id = $entity->id();
      $entity_query->condition('field_activity_entity.target_id', $entity_id, '=');
      $entity_query->condition('field_activity_entity.target_type', $entity_type, '=');

    }
    if (!empty($status)) {
      $entity_query->condition('field_activity_status', $status, 'IN');
    }

    $ids = $entity_query->execute();

    return $ids;
  }
private function getNotificationIds(AccountInterface $account, array $status = [], Entity $entity = NULL) {
    $destinations = ['notifications'];

    $uid = $account->id();

    $entity_query = \Drupal::entityQuery('activity');
    $entity_query->condition('field_activity_recipient_user', $uid, '=');
    $entity_query->condition('field_activity_destinations', $destinations, 'IN');

    if ($entity !== NULL) {
      $entity_type = $entity->getEntityTypeId();
      $entity_id = $entity->id();
      $entity_query->condition('field_activity_entity.target_id', $entity_id, '=');
      $entity_query->condition('field_activity_entity.target_type', $entity_type, '=');

    }
    if (!empty($status)) {
      $entity_query->condition('field_activity_status', $status, 'IN');
    }

    $ids = $entity_query->execute();

    return $ids;
  }
private function getNotificationIds ( AccountInterface $ account , array $ status = [ ] , Entity $ entity = NULL ) { $ destinations = [ 'notifications' ] ; $ uid = $ account -> id ( ) ; $ entity_query = \ Drupal :: entityQuery ( 'activity' ) ; $ entity_query -> condition ( 'field_activity_recipient_user' , $ uid , '=' ) ; $ entity_query -> condition ( 'field_activity_destinations' , $ destinations , 'IN' ) ; if ( $ entity !== NULL ) { $ entity_type = $ entity -> getEntityTypeId ( ) ; $ entity_id = $ entity -> id ( ) ; $ entity_query -> condition ( 'field_activity_entity.target_id' , $ entity_id , '=' ) ; $ entity_query -> condition ( 'field_activity_entity.target_type' , $ entity_type , '=' ) ; } if ( ! empty ( $ status ) ) { $ entity_query -> condition ( 'field_activity_status' , $ status , 'IN' ) ; } $ ids = $ entity_query -> execute ( ) ; return $ ids ; }
Returns the Activity ids for an account with destination 'notification'.

@param \Drupal\Core\Session\AccountInterface $account
Account object.
@param array $status
Array of statuses.
@param \Drupal\Core\Entity\Entity $entity
Optionally provide a related entity to get the activities for.

@return array
Returns an array of notification ids.
Returns the Activity ids for an account with destination notification .