You are here

private function SocialProfileTrait::startQuery in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  2. 8.4 modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  3. 8.6 modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  4. 8.7 modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  5. 8.8 modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  6. 10.3.x modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  7. 10.0.x modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  8. 10.1.x modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()
  9. 10.2.x modules/social_features/social_profile/src/SocialProfileTrait.php \Drupal\social_profile\SocialProfileTrait::startQuery()

Start a Social Profile Mention Query.

Return value

\Drupal\Core\Database\Query\SelectInterface Returns the query object.

1 call to SocialProfileTrait::startQuery()
SocialProfileTrait::getUserIdsFromName in modules/social_features/social_profile/src/SocialProfileTrait.php
Get a list of account IDs whose account names begin with the given string.

File

modules/social_features/social_profile/src/SocialProfileTrait.php, line 116

Class

SocialProfileTrait
Trait SocialProfileTrait.

Namespace

Drupal\social_profile

Code

private function startQuery() {
  $connection = \Drupal::database();
  $query = $connection
    ->select('users', 'u')
    ->fields('u', [
    'uid',
  ]);
  $query
    ->join('users_field_data', 'uf', 'uf.uid = u.uid');
  $query
    ->leftJoin('profile', 'p', 'p.uid = u.uid');
  if ($this
    ->useFullName()) {
    $query
      ->leftJoin('profile__field_profile_first_name', 'fn', 'fn.entity_id = p.profile_id');
    $query
      ->leftJoin('profile__field_profile_last_name', 'ln', 'ln.entity_id = p.profile_id');
  }
  if ($this
    ->addNickName() === TRUE) {
    $query
      ->leftJoin('profile__field_profile_nick_name', 'nn', 'nn.entity_id = p.profile_id');
  }
  $query
    ->condition('uf.status', 1);
  return $query;
}