You are here

public function EventMeta::buildEventRegistrantQuery in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/EventMeta.php \Drupal\rng\EventMeta::buildEventRegistrantQuery()

Builds a entity query for registrants with conditions referencing this event via the registration entity.

Return value

\Drupal\Core\Entity\Query\QueryInterface An entity query.

Overrides EventMetaInterface::buildEventRegistrantQuery

File

src/EventMeta.php, line 300

Class

EventMeta
Meta event wrapper for RNG.

Namespace

Drupal\rng

Code

public function buildEventRegistrantQuery() {
  $query = \Drupal::database()
    ->select('registrant', 'ant');
  $query
    ->join('registration', 'ion', 'ion.id = ant.registration');
  $query
    ->join('registration_field_data', 'rfd', 'ion.id = rfd.id');
  $query
    ->fields('ant', [
    'id',
  ]);
  $query
    ->condition('rfd.event__target_type', $this
    ->getEvent()
    ->getEntityTypeId(), '=');
  $query
    ->condition('rfd.event__target_id', $this
    ->getEvent()
    ->id(), '=');
  return $query;
}